FoxIO-LLC / ja4-nginx-module

Nginx module that calcuates fingerprints from the JA4+ suite
https://foxio.io
Other
33 stars 5 forks source link

SEGV with log_level debug #6

Open pepl opened 3 months ago

pepl commented 3 months ago

Once we have the nginx error_log configured with debug we're seeing segmentation faults along this backtrace:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  ngx_sprintf_str (buf=0x7fffcfd36ec1 ": 0202\n\n\n2\n\n: 7c76daad20ec\n\nceb02e3d3d0d5534f8b5cbc6639b2a4750e45c5f\n\n", 
    last=last@entry=0x7fffcfd37680 "\257x\323\317\377\177", src=0x0, len=18446744073709551615, hexadecimal=0) at src/core/ngx_string.c:580
580 src/core/ngx_string.c: No such file or directory.
(gdb) bt
#0  ngx_sprintf_str (buf=0x7fffcfd36ec1 ": 0202\n\n\n2\n\n: 7c76daad20ec\n\nceb02e3d3d0d5534f8b5cbc6639b2a4750e45c5f\n\n", 
    last=last@entry=0x7fffcfd37680 "\257x\323\317\377\177", src=0x0, len=18446744073709551615, hexadecimal=0) at src/core/ngx_string.c:580
#1  0x000055768242dbf2 in ngx_vslprintf (buf=<optimized out>, 
    buf@entry=0x7fffcfd36eac "ssl_ja4: ALPN Value: : 0202\n\n\n2\n\n: 7c76daad20ec\n\nceb02e3d3d0d5534f8b5cbc6639b2a4750e45c5f\n\n", 
    last=last@entry=0x7fffcfd37680 "\257x\323\317\377\177", fmt=<optimized out>, fmt@entry=0x5576828a34ec "ssl_ja4: ALPN Value: %s\n", args=args@entry=0x7fffcfd36e68)
    at src/core/ngx_string.c:271
#2  0x0000557682429332 in ngx_log_error_core (level=level@entry=8, log=0x557683fe60e0, err=err@entry=0, fmt=fmt@entry=0x5576828a34ec "ssl_ja4: ALPN Value: %s\n")
    at src/core/ngx_log.c:135
#3  0x00005576824d3779 in ngx_ssl_ja4_detail_print (ja4=0x7fffcfd377d0, pool=0x557683fda190)
    at /BUILD/build-2024-04-25/ja4-nginx-module-1.0.0-beta/src/ngx_http_ssl_ja4_module.h:306
#4  ngx_ssl_ja4_fp (pool=0x557683fda190, ja4=ja4@entry=0x7fffcfd377d0, out=out@entry=0x7fffcfd377c0)
    at /BUILD/build-2024-04-25/ja4-nginx-module-1.0.0-beta/src/ngx_http_ssl_ja4_module.c:433
#5  0x00005576824d3a20 in ngx_http_ssl_ja4 (r=0x557683fda1e0, v=0x557683fdaea8, data=<optimized out>)
    at /BUILD/build-2024-04-25/ja4-nginx-module-1.0.0-beta/src/ngx_http_ssl_ja4_module.c:453
#6  0x000055768247bc65 in ngx_http_get_indexed_variable (r=0x557683fda1e0, index=<optimized out>) at src/http/ngx_http_variables.c:637
#7  0x000055768247cd54 in ngx_http_script_copy_var_len_code (e=<optimized out>) at src/http/ngx_http_script.c:944
#8  0x00005576824b88e5 in ngx_http_proxy_create_request (r=0x557683fda1e0) at src/http/modules/ngx_http_proxy_module.c:1357
#9  0x00005576824868c0 in ngx_http_upstream_init_request (r=0x557683fda1e0) at src/http/ngx_http_upstream.c:627
#10 0x0000557682479551 in ngx_http_read_client_request_body (r=r@entry=0x557683fda1e0, post_handler=0x557682487df0 <ngx_http_upstream_init>)
    at src/http/ngx_http_request_body.c:47
#11 0x00005576824bba29 in ngx_http_proxy_handler (r=0x557683fda1e0) at src/http/modules/ngx_http_proxy_module.c:1023
#12 0x0000557682469ef2 in ngx_http_core_content_phase (r=0x557683fda1e0, ph=<optimized out>) at src/http/ngx_http_core_module.c:1261
#13 0x0000557682464c45 in ngx_http_core_run_phases (r=0x557683fda1e0) at src/http/ngx_http_core_module.c:875
#14 0x0000557682470bc8 in ngx_http_process_request_headers (rev=rev@entry=0x7f039687a7f0) at src/http/ngx_http_request.c:1496
#15 0x0000557682471010 in ngx_http_process_request_line (rev=0x7f039687a7f0) at src/http/ngx_http_request.c:1163
#16 0x000055768245557b in ngx_epoll_process_events (cycle=0x557683fd61d0, timer=<optimized out>, flags=<optimized out>) at src/event/modules/ngx_epoll_module.c:901
#17 0x000055768244a1cf in ngx_process_events_and_timers (cycle=cycle@entry=0x557683fd61d0) at src/event/ngx_event.c:248
#18 0x0000557682452e85 in ngx_worker_process_cycle (cycle=cycle@entry=0x557683fd61d0, data=data@entry=0x0) at src/os/unix/ngx_process_cycle.c:721
#19 0x0000557682451607 in ngx_spawn_process (cycle=cycle@entry=0x557683fd61d0, proc=0x557682452e20 <ngx_worker_process_cycle>, data=0x0, 
    name=0x55768288e736 "worker process", respawn=respawn@entry=0) at src/os/unix/ngx_process.c:199
#20 0x00005576824542e7 in ngx_reap_children (cycle=0x557683fd61d0) at src/os/unix/ngx_process_cycle.c:598
#21 ngx_master_process_cycle (cycle=0x557683fd61d0) at src/os/unix/ngx_process_cycle.c:174
#22 0x0000557682427c54 in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:383