Skip to content

Fix overflow detection logic in state filter - #3

Open
AmaliaI12 wants to merge 2 commits into
masterfrom
AmaliaI12/fix_overflow_detection
Open

Fix overflow detection logic in state filter#3
AmaliaI12 wants to merge 2 commits into
masterfrom
AmaliaI12/fix_overflow_detection

Conversation

@AmaliaI12

Copy link
Copy Markdown

Overflow detection depended on the type field being set to overflow_variable before the filter was applied. When the flag was not assigned, some valid overflow paths were ignored.

This PR depends on #2 . Please review after #2 is merged.

@razvand
razvand self-requested a review January 16, 2026 15:09
@razvand razvand self-assigned this Jan 16, 2026
@razvand
razvand requested a lite review from Copilot August 17, 2026 06:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make overflow-path detection more reliable in the simulation manager filter so valid overflow states aren’t missed, and it also adjusts several long-running timeout_decorator usages (and some tooling interactions) used during exploration/exploitation flows.

Changes:

  • Updates overflow_detect_filter logic used by overflow detection during symbolic exploration.
  • Switches multiple timeout_decorator.timeout(...) usages to use_signals=False and (in some detectors) returns/propagates the simgr.explore(...) result.
  • Introduces a binary copy step (named radare2_binary) before running local processes / fetching register values.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
zeratool_lib/simgr_helper.py Modifies the overflow state filter logic used to classify/stash vulnerable states.
zeratool_lib/overflowRemoteLeaker.py Adjusts timeout behavior for remote libc leak exploration.
zeratool_lib/overflowExploitSender.py Adds a binary copy step before spawning the local process.
zeratool_lib/overflowExploiter.py Adds a binary copy step and routes getRegValues through it; adjusts timeout behavior.
zeratool_lib/overflowDetector.py Adjusts timeout behavior and captures the returned SimulationManager.
zeratool_lib/formatExploiter.py Adjusts timeout behavior and captures the returned SimulationManager.
zeratool_lib/formatDetector.py Adjusts timeout behavior and captures the returned SimulationManager.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 295 to 301
for state in simgr.active:
if state.globals.get("type", None) == "overflow_variable":
user_input = state.globals.get("user_input", None)
if user_input is not None:
log.info("Found vulnerable state. Overflow variable to win")
user_input = state.globals["user_input"]
#user_input = state.globals["user_input"]
input_bytes = state.solver.eval(user_input, cast_to=bytes)
log.info("[+] Vulnerable path found {}".format(input_bytes))
Comment on lines +19 to +26
radare2_binary_name = "/radare2_binary"
fin = open(binary_name, "rb")
fout = open(radare2_binary_name, "wb")
fout.write(fin.read())
fin.close()
fout.close()
os.chmod(radare2_binary_name, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

Comment on lines +58 to +65
radare2_binary_name = "/radare2_binary"
fin = open(binary_name, "rb")
fout = open(radare2_binary_name, "wb")
fout.write(fin.read())
fin.close()
fout.close()
os.chmod(radare2_binary_name, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants