Repository navigation
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
CLA signed (Google Individual CLA, GitHub username newkpl) — rechecking the CLA status. |
This branch has not been deployed
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.
NsJailConfig's Exe.path is a required proto2 field, but config::parseFile() never checks IsInitialized() on the parsed config, and the ProtoJSON path (util::JsonStringToMessage) — unlike TextFormat — does not enforce required fields.
A ProtoJSON config such as {"execBin": {"arg0": "ARG0ONLY"}} therefore reaches parseInternal() with has_exec_bin=1, has_path=0, arg_size=0, where nsj->argv[0] = njc.exec_bin().arg0() writes into an empty std::vector → deterministic SEGV (null dereference in the libstdc++ string assignment), reproduced 3/3 at HEAD (d1d9af3) with an ASan-instrumented build: SEGV on unknown address 0x000000000000, top frame config::parseInternal ← config::parseFile ← cmdline::parseArgs ← main. Also reproduced in a plain (non-sanitizer) micro-repro of the exact code shape (SIGSEGV, rc=139).
A sibling variant (args present, no path) does not crash but silently overwrites argv[0], and setupArgv() then promotes it to the executed program — wrong-program execution from a malformed config.
Fix:
Verification: with this patch, both JSON attack variants are cleanly rejected ("Config file ... is missing required fields", rc=255, no sanitizer report), and valid TextFormat/ProtoJSON control configs behave unchanged. TextFormat twins of the attack configs were already rejected by the parser, confirming the JSON path was the gap.
Severity is low/hardening: the config file is operator-supplied; impact is a launcher crash or wrong-program execution from a malformed config. No sandbox-boundary, privilege, or jailed-process impact.
Disclosure: this patch was prepared with AI assistance; the crash, the sibling variant, and the fix were all reproduced and verified on local builds before submission.