Fix command injection via bclass field in binary loading (CVE) ##security#25714
Open
Fix command injection via bclass field in binary loading (CVE) ##security#25714
Conversation
The bclass field containing "://" triggered an IO plugin redirection in cfile.c that passed unsanitized binary metadata to r_core_cmdf(), enabling arbitrary command execution via crafted smd/pebble/io binaries. - Rewrite the bclass redirection in cfile.c to validate the URI scheme against registered IO plugins and use direct API calls (r_core_file_open + r_core_bin_load) instead of r_core_cmdf. Add a recursion guard to prevent infinite redirection loops. - Use r_core_cmd_callf instead of r_core_cmdf in cmd_debug.inc.c get_bin_info() to avoid r2 command parser interpreting metacharacters in debug map filenames. - Sanitize dbglink from ELF .gnu_debuglink sections in cmd_info.inc.c before use in command output strings. - Harden r_str_sanitize() to also cover newlines, backslash, quotes and the r2 shell escape character (!). Fixes #25708 https://claude.ai/code/session_01XrfBCsbvdH1yZToZLeLQh3
5d0882e to
bdc12bf
Compare
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.
The bclass field from binary metadata (smd, pebble, io plugins) was passed
unsanitized to r_core_cmdf() in cfile.c, allowing arbitrary command execution
via crafted binaries containing newlines and shell metacharacters in the
bclass field.
Multi-layered fix:
cfile.c to eliminate the command injection vector entirely
and the r2 shell escape character (!)
to r_core_cmdf on macOS
call in cbin.c to avoid command parsing of binary metadata
Fixes #25708
https://claude.ai/code/session_01XrfBCsbvdH1yZToZLeLQh3