3 ms·
Apart from the backdoor, this code seems completely ridden with bugs. E.g. if(strstr(header, "User-Agent:") != NULL) { http_request_t->0xD0 = h
by Nitramp 13y ago
Apart from the backdoor, this code seems completely ridden with bugs. E.g.
if(strstr(header, "User-Agent:") != NULL)
{
http_request_t->0xD0 = header + strlen("User-Agent:") + strspn(header, " \t");
}
Note how you could have a header some includes 'User-Agent:' somewhere back in the value, and the arrive with an entirely incorrect pointer to what you think is the value - strstr just finds the needle anywhere in the haystack, not necessarily at the beginning. This particular piece (AFAICT) cannot be exploited for e.g. overruns or similar, maybe just for a subsequent crash or unexpected behaviour due to lack of input sanitization, but still, crazy strstr juggling on untrusted user input? oh oh.
If the rest of this code looks like that, this should never, ever be exposed to the wild wild web.
- __david__ 13y agoSo while you're right that the strstr() is lazy (should probably be a strncmp() or something), it's probably not that big of a deal in this particular case. The worst an attacker could do here is get a weird user agent string, which they could already do by just setting the User-Agent field to something weird...