Cyber Risks · Trail of Bits Blog

Typos that omit security features and how to test for them

Summary: During a security audit, a Trail of Bits researcher found a typo that failed to enable _FORTIFY_SOURCE, the macro-based mitigation that swaps C functions like strcpy for checked wrappers such as __strcpy_chk. Searching with grep.app, sourcegraph.com, and cs.github.com, the researcher found and sent 20 pull requests for the same pattern across C and C++ projects on GitHub.

Key Takeaway: Neither the libc nor the compiler flags a misspelled macro, so passing -DFORTIFY_SOURCE=2 instead of -D_FORTIFY_SOURCE=2 silently leaves memory-corruption checks off in the shipped binary. The same class of error has already appeared in real packages, including Debian's Nginx package, and in the recommendation text of BinSkim.

Read the original at Trail of Bits Blog ↗