Master C and C++ with our new Testing Handbook chapter#2111
Open
carlospolop wants to merge 1 commit intomasterfrom
Open
Master C and C++ with our new Testing Handbook chapter#2111carlospolop wants to merge 1 commit intomasterfrom
carlospolop wants to merge 1 commit intomasterfrom
Conversation
Collaborator
Author
🔗 Additional ContextOriginal Blog Post: https://blog.trailofbits.com/2026/04/09/master-c-and-c-with-our-new-testing-handbook-chapter/ Content Categories: Based on the analysis, this content was categorized under "Generic Methodologies & Resources -> Source code Review / SAST Tools (or create/add under a Secure Code Review subsection for C/C++ gotchas); additionally cross-link from Pentesting Web -> Command Injection (system()/shelling-out pitfalls) and Windows Local Privilege Escalation/Windows security notes for CreateProcess unquoted path & WorstFit path issues". Repository Maintenance:
Review Notes:
Bot Version: HackTricks News Bot v1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Automated Content Update
This PR was automatically generated by the HackTricks News Bot based on a technical blog post.
📝 Source Information
🎯 Content Summary
What this post is
Trail of Bits announces a new Testing Handbook chapter: a comprehensive security checklist for C and C++ code, aimed primarily at manual source review (as opposed to chapters focused on static/dynamic analysis tooling). The chapter is organized from language-level bug classes to environment-specific gotchas across Linux, Windows, and sandboxing. It also teases an upcoming Claude skill that will transform checklist items into platform- a...
🔧 Technical Details
inet_ntoa()) return pointers to static internal storage. If code calls the function twice and stores both pointers (e.g., resolving a user-provided IP and an allowlisted IP) and then compares them withstrcmp, the second call may overwrite the buffer, causing both pointers to reference the same final string. This can collapse an allowlist check and let disallowed values pass.2) Shell command execution from validated-but-reused input: Even if an input string is “validated” with a parser (e.g.,
inet_aton), reusing the original raw string to build a shell command and invokingsystem()creates a command-injection/RCE primitive because a shell interprets metacharacters. Safer patterns are to avoid shelling out or to use non-shell process creation with an argv array.3) Kernel/driver control-flow influenced ...
🤖 Agent Actions
I’m mapping the repo first and then I’ll read the most relevant existing pages before deciding where a single update belongs. After that I’ll verify whether the blog adds genuinely new material or just repeats content already present.
The repo already has a likely anchor page for source-review material, but I need to confirm whether the concrete gotchas from the blog are already documented elsewhere. I’m reading the review page plus Windows and command-injection candidates now to avoid duplicating existing content.
I’ve confirmed the main concrete additions are not already documented:
inet_ntoa()static-buffer misuse, validated-but-reused input reachingsystem(), and driver code that trusts attacker-chosen registry paths for control-flow decisions. I’m reading one more adjacent page plus the target file’s tail so I can patch a single page cleanly and keep references at the end.I’ve got the placement decision. Next I’m validating the source material and the handbook chapter itself so the added checklist points stay tight and technically defensible instead of turning into a vague summary of the blog.
I’m editing
code-review-tools.mdnow. The patch will keep everything in one file and add a short C/C++ manual-review subsection with concrete bug patterns, small examples, and references at the end.Updated code-review-tools.md with a new
C/C++ Manual Review Gotchassection.The added content abstracts the technical value from the blog into reusable review guidance instead of documenting the blog post itself:
inet_ntoa()static-buffer allowlist bypasses, validated-but-raw input later reachingsystem(), Windows driver patterns where attacker-chosen registry paths influence privileged control flow, and Windows path-handling review checks including unquotedCreateProcess*paths and WorstFit-style ANSI/Wide-char issues. I also added a final## Referencessection with the blog, the handbook chapter, and the WorstFit article.Verified the diff and kept the change to a single file. No tests were needed for this markdown-only update.
This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.