Skip to content

fix(elf): require complete zlib section-name streams - #10148

Closed
wunianze666-netizen wants to merge 1 commit into
morluto:mainfrom
wunianze666-netizen:codex/elf-zlib-section-name-stream
Closed

wunianze666-netizen wants to merge 1 commit into
morluto:mainfrom
wunianze666-netizen:codex/elf-zlib-section-name-stream

Conversation

@wunianze666-netizen

Copy link
Copy Markdown
Contributor

Summary

Require a zlib-compressed ELF section-name table to consume its declared payload before publishing section names.

Problem and expected behavior

An ELF file can declare a zlib-compressed section-name table containing a valid stream followed by unrelated bytes or a second stream. Both inspect-elf-notes and inspect_elf_notes returned the first stream's names as complete Evidence. The ELF compression definition assigns the declared payload to zlib data, and RFC 1950 defines the stream boundary at its checksum. ELF gABI compressed sections · RFC 1950

Change and scope

Use the existing bounded inflater's consumed-byte count at the shared section-name decoder. A stream that ends before the declared section end returns the decoder's existing malformed outcome. The regression came from inspecting this decoder. Related #9330 validates alignment, and #9560 factors header admission for debug-file linkage.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the shared ELF section-name decoder checks the zlib stream before publishing decoded names.
  • Contribution scope fit and linked maintainer decision: ordinary offline format correction within existing inspection.
  • CLI and MCP/tool-catalog contract: malformed zlib storage uses the existing input refusal.
  • Provider, bridge, target-format, or platform compatibility: passive ELF parsing with the existing Node zlib decoder. The decoder retains its existing output budget and Zstandard branch.
  • Evidence, artifact, provenance, or reconstruction contract: a valid normalized result and digest stay equal on the controls.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): the caller-selected ELF file stays inside the current read-only workflow.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): existing schemas and generated tool metadata.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: the native directory reader exercises a nonzero suffix, zero bytes, and a second zlib stream within the declared section extent. The same suffixes outside that extent leave the decoded name intact.
  • Base reproduction or other evidence: clean 047d75a498f18a6608f35ee5e36cf1bf0f81ca97 accepted the two malformed fixtures through both compiled surfaces. The candidate rejects both fixtures with the same path and SHA-256. The exact stream and the outside-section control retain equal full normalized reports.
  • User-visible CLI/MCP output (if applicable): the CLI exits 1 with invalid_request and category invalid_input; the SDK receives the corresponding canonical error.
  • Remaining proof gaps: Windows Node 24.22.1 with synthetic ELF objects. Live ELF execution and external engines are separate workflows.

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • Existing native directory suite with the new regressions reproduced three failures on accepted main. The candidate targeted source and MCP run reported 89 passed | 1 skipped (90).
  • Four actual CLI and four same-connection production SDK cases per revision. The full named tool definition, JSON Schema 2020-12 meta-schemas, actual input/output or typed error, digest, and client cleanup were checked.
  • CI-fast static checks, architecture guards, and diff checks passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: malformed zlib section-name streams use the existing refusal.
  • Real Hopper/Ghidra, browser, or OS coverage: Windows Node 24.22.1, passive synthetic ELF.
  • Package or release metadata impact: existing ELF reader behavior and guide.
  • Security, privacy, process, or containment review: existing bounded inflation and file ownership.

Author readiness

Human owner: @wunianze666-netizen

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T00:11:10.776946Z 818e6e7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@morluto

morluto commented Nov 19, 2026

Copy link
Copy Markdown
Owner

The current-base replacement is #12193. It requires the zlib stream to consume the whole declared compressed payload in the shared ELF section decoder and covers both trailing bytes and a second stream. The combined head is validated and queued for squash merge. Thanks for the original fix.

@morluto morluto closed this Nov 19, 2026
morluto added a commit that referenced this pull request Nov 19, 2026
* fix(elf): reject invalid section table and zlib declarations

Refs #10149, #10148, #9330.

Co-authored-by: Nianze Wu <[email protected]>

* fix(elf): share section count admission with carrier readers (#12196)

fix(elf): admit section tables before carrier recognition

---------

Co-authored-by: Nianze Wu <[email protected]>
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants