`x509_from_der` segfaults with invalid input
Author: evantypanskiCreated Sep 30, 2026Updated Sep 30, 2026
LabelsGood First Issue
Found this when LLM vuln scanning. The following script segfaults when running with zeek test.zeek (if saved in test.zeek):
@load base/files/x509
event zeek_init()
{
local cert = x509_from_der("not a der certificate");
print x509_parse(cert);
}Running it:
$ zeek test.zeek
[1] 31300 segmentation fault zeek test.zeekThat is because the result of d2i_X509 in the BiF gets unconditionally used in the opaque here. Perhaps that should cause an error, or that function could return a result type of sorts. It should not segfault.
Seems like that function returns nullptr on error (from here).
Source: zeek/zeek