Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: using the /cetcompat linker switch to support shadow stacks |
|
| Author |
|
mdlawler
Joined: 02 Dec 2026 Posts: 1
|
Posted: Wed 02 Dec '26 21:27 Post subject: using the /cetcompat linker switch to support shadow stacks |
|
|
I'd like to see builds of httpd and modules use the /cetcompat linker switch to support shadow stacks on hardware where it is available. Httpd would need to be set for compatible modules only and then all modules would need to be linked with /cetcompat. Perhaps we could even get php to do this in 8.6 builds. I'm interested in others thoughts on this idea.
https://learn.microsoft.com/en-us/cpp/build/reference/cetcompat?view=msvc-170 |
|
| Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 481 Location: UK
|
Posted: Fri 04 Dec '26 21:27 Post subject: |
|
|
I've been thinking about your proposal, and reading up somewhat on the /CETCOMPAT linker switch and "shadow stacks" - Control-flow Enforcement Technology (CET).
Whilst the concept is laudable, and there is a reasonable argument for enabling it, viz:
- Apache is an internet-facing application.
- ROP (Return-Oriented Programming) protection is a worthwhile additional security mitigation.
- The change is relatively small at the linker level.
- Compatibility mode allows gradual adoption without requiring all third-party modules to be rebuilt. However, there are also reasons to not make it an unconditional requirement:
- It only benefits supported x64 Windows environments.
- It requires OS and hardware support.
- It addresses a specific class of exploitation rather than vulnerabilities generally.
- The actual security benefit depends on the mitigation being enabled, not simply the presence of the PE flag.
- It introduces an additional compatibility consideration when modules perform unusual stack manipulation or other CET-incompatible operations. And this last point is the one that really bothers me...
In compatibility mode, a return-address mismatch in a module not marked CET-compatible is permitted, although Windows still incurs the overhead of handling the mismatch. However, if the mismatch occurs in a module marked CET-compatible, it is fatal, the processor would raise a control-protection exception (#CP), which Windows handles as a process-level failure. In practice this would mean the HTTPD process would die.
Considering this possibility, the Apache Lounge build cannot realistically test/validate the stack handling for every combination of:
- Apache Software Foundation (ASF) modules.
- Third-party modules.
- PHP integrations.
- Other DLLs loaded into the HTTPD process. So even if the standard Apache modules work correctly, that doesn't establish compatibility across the wider ecosystem.
I note Microsoft's documentation actually says that native 64-bit Windows DLLs are already built with '/CETCOMPAT' https://techcommunity.microsoft.com/blog/WindowsOSPlatform/developer-guidance-for-hardware-enforced-stack-protection/2163340. So the main uncertainty isn't Windows' own DLLs; it's the third-party ecosystem.
On balance I personally feel there is insufficient justification for introducing this additional compatibility risk into the standard Apache Lounge builds. If someone wishes to experiment with CET support, at this point I think that is better left to individual builds where the appropriate module configuration can be tested.
I'd be interested to hear other people's views on this subject. |
|
| Back to top |
|
|
|
|
|
|