-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCSP request with --phone-out and with supplied binary when using systemd for host resolution with my*entries segfaults #2516
Comments
Hi @multiflexi ,
|
Yes, only with --phone-out. |
Ok, thanks! I meant just the command which segfaulted. I'll guess I'll find the segfault in the hay stack later ;-) |
Plan is to compile the binaries on a newer platform , while tackling #2356 |
Hi @multiflexi : can you please try his binary: https://testssl.sh/openssl-1.0.2k-bad/openssl.Linux.x86_64.static and let me know whether it works? |
Hi, sorry for the delay. It still outputs Segmentation fault: |
Sigh. OK, thanks. That was on Fedora 40 only and not on Ubuntu 22.04? In the above strace I maybe found something fishy but I can't really tell. Does that happen when checking a specific host or any host? |
This was on current Manjaro. Today I also tested Fedora 41 with the same error and Ubuntu 22.04 where it worked fine. It happens when checking any host. |
Thanks, but it seems I can't correlate your line 2044 (here: line 2091) with the strace output. As said if it really segfaults there it would help if you could only strace that line. |
How can I do that? |
|
I should have think of that 😄 Here you go. |
Thanks! Did you supply the -f flag? It doesn't give me a strong hint as I hoped. It looks more like openssl triggered the problem but is not the problem. Before the thing segfaulted the loader was mapped into memory. Then some of the memory was protected to read only. Then SEGV_MAPERR indicated that some memory was accessed to which the pointer was wrong or it wasn't possible. Address is likely not 0x1e83c0 . Wild guess: Do the distros where it segfaults the same |
for testing sakes, can't you try to set the host entries for the first two to PS: Never heard about myhostname or mymachines before but looking at an Alma Linux test machine here says it's using systemd . Oh well... |
So I tested it on Fedora and if dns is at the end of hosts line, it segfaults, if I move it to the second place, it works fine. I am able to reproduce it every time. |
Awesome. Thanks for helping to clarify though! At the moment I'd rather leave it (the cause) like it is -- as I am clueless and this seems to be the either systemd's problem or is somewhere in the middle between systemd and the openssl used. I changed the title. What I could do as a mitigation is trying to catch the segfault and issue a warning I assume "your" segfault didn't stop the whole scan? If you like , maybe you can try the remove other entries and or move dns in nsswitch around. |
No, the segfault does not stop the scan. I will try to play with nsswitch in free time. |
NOTFOUND=return looks strange, but maybe I have to rtfm before guessing 😃 |
Hi @multiflexi , can you have a short look what dmesg shows when the segfault occurs? |
Hi @multiflexi : can you please check which error number dmesg shows when using the new and if possible old binary., like
At a certain point I'd like to provide new binaries and if possible I'd like to get this issue fixed. I am not that tempted to clog this repo with another set of new binaries later. |
With the standard version on Manjaro:
With the new version:
|
I am a little bit further but this is a tough one and not yet finally resolved.... For the record the following -- using the new binary: Under Fedora 41 which I installed there were entries in the audit log as the binary did a connectTo call which SELinux prevented:
That seemed to be part of a problem (but can´t tell why a user shouldn't seem to be allowed to connect somewhere with any binary). But still, if I built a SELinux module and loaded it into the kernel, it didn't help and it still segfaults.
Which kind of confirms my assumption that the nss with myhostname is the culprit here. As of now I see only three possible solutions
As said, there's also a docker issue which looks similar, see #2667 . There nss + myhostname isn´t involved but the possible fixes would be the same. |
TL;DR: I believe the problem is static linking. However using an executable with dynamic linking under a variety of Linux systems is a pain in the <...> -- at least according to what I learned the hard way years ago. So for the time being I'll prepare a automagic switch to I thought a problem could have been the old code base of "our" openssl-bad. So I compiled the latest versions of 1.1.1, 1.1.0 and also 1.0.2: Same segfault. For the 1.1.x branches when running the openssl supplied test suites there were even tons of warning messages like warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking. Same message regarding dlopen. Thread e.g.: https://stackoverflow.com/questions/57476533/why-is-statically-linking-glibc-discouraged/57478728#57478728 PS: musl libc or diet libc seems no option to me. Don´t know how go binaries do that... |
…ne-out (3.0) As `--phone-out` sometimes doesn't work with our binary we switch transparently/automagically to the vendor support openssl binary -- if available. This is the PR for 3.0, for 3.2 see #2695 . This fixes at least #2516 where the issue has been explained/debugged in detail. See also #2667 and #1275.
The error is:
testssl.sh/testssl.sh: line 2031: 3055367 Segmentation fault $OPENSSL ocsp -no_nonce ${host_header} -url "$uri" -issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem -CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
This happens with --phone-out with supplied openssl (the bad version), but when the openssl is compiled from the source, the error does not occur. Also it does not occur with the system provided openssl.
Using the latest 3.2 version
Tested distros: Fedora 40, Ubuntu 22.04 and Slackware 15
The text was updated successfully, but these errors were encountered: