logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: using the /cetcompat linker switch to support shadow stacks
Author
mdlawler



Joined: 02 Dec 2026
Posts: 2

PostPosted: Wed 02 Dec '26 21:27    Post subject: using the /cetcompat linker switch to support shadow stacks Reply with quote

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

PostPosted: Fri 04 Dec '26 21:27    Post subject: Reply with quote

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
mdlawler



Joined: 02 Dec 2026
Posts: 2

PostPosted: Sun 06 Dec '26 8:35    Post subject: Reply with quote

What you say above makes a lot of sense. What about a middle ground where Apache Lounge built a test build for the current httpd and the current extra modules that are provided and allow the community to test the build. Since many third party modules php, etc are probably not using CET and thus aren't marked compatible they couldn't cause the process to die. If there are legitimate bugs that need to be fixed this test build would help find them. Since the current builds only work on windows 8.1 (I think this is the minimum) and above and most users are using Windows 10 or 11 and the latest Windows 10 supports this the OS support will mostly be there. Since the x64 build is the most commonly used this is also good. As time goes forward more and more hardware in use will support CET. Having a test build and a forum topic like this one would help the community validate the technology in httpd and prepare for officially supporting it at some point in the future. As for other dlls injecting into httpd since most people probably run it as a service the only dlls able to inject are usually low level like AV and again a test build would help us understand if there were going to be problems.
Back to top


Reply to topic   Topic: using the /cetcompat linker switch to support shadow stacks View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads