Open macskas opened 6 months ago
seems there're a buffer overflow in ja3, let me try to figure out.
If you need help in testing / debugging I can build & deploy in 15 minutes to see if a fix works. I also shared a private github repo with the last core & binary & debug symbols.
I had time to check up on this. I created a patch where I check allocation success & etc and its working just fine now, no segfaults. I think this might have been the main issue in ngx_http_v2.c:
if (!h2c->fp_fingerprinted && h2c->fp_settings.len < 32) {
h2c->fp_settings.data[h2c->fp_settings.len] = (uint8_t)id;
*(uint32_t*)(h2c->fp_settings.data + h2c->fp_settings.len + 1) = (uint32_t)value;
h2c->fp_settings.len += 5;
}
I am not familiar with ngx internal data structures so I checked every allocation and variables to make sure there is no issue with them, but might not needed at all at the end. So please somehow keep only the necessary checks you know its needed. nginx-patch.tar.gz
@macskas do you have fork repository with your fix? not file attachment
@macskas do you have fork repository with your fix? not file attachment
I created a fork & run the test for the changes: https://github.com/macskas/nginx-ssl-fingerprint
I cannot reproduce the error with curl, I can't see it in the logs(segfaults before the log) and there are like 4k rps on a single server, so debug logs are not really an option :( In the core I see the orignal request url with gdb. But thats about it. If I call the url directly there is no error.
Today I tested with and without ja3 patch. Same build process (official openresty builder). With ja3, there is a segfault in every 10 minutes, without it no segfault at all.
The core contains sensitive information so I cannot share it publicly,
I know this is not much: