Skip to content

BTF string offset boundary check can panic parser on malformed ELF/BTF input #2019

Closed

Description

@thesmartshadow

Describe the bug

github.com/cilium/ebpf can panic while parsing malformed BTF / BTF.ext metadata through public parser APIs such as LoadCollectionSpec and LoadCollectionSpecFromReader.

The issue is in shared BTF string-table lookup logic. A malformed .BTF or .BTF.ext record can set a non-zero string offset equal to BTF StringLen. This boundary value is incorrectly treated as valid, even though it points to the end of the string table. The parser then searches for a NUL byte in an empty slice, receives -1, and reaches an invalid slice bound, causing a Go panic instead of returning a parse error.

Expected behavior:

Malformed BTF / BTF.ext input should return an error.

Actual behavior:

The parser panics. In a process that parses less-trusted eBPF ELF/BTF artifacts, this can cause process-level denial of service.

I validated the same boundary issue through multiple fields:

  • .BTF btf_type.NameOff
  • .BTF.ext func_info SecNameOff
  • .BTF.ext line_info SecNameOff
  • .BTF.ext line_info FileNameOff
  • .BTF.ext line_info LineOff

The demonstrated impact is denial of service only.

How to reproduce

I prepared a compact reproduction package with PoC source, commands, observed results, and evidence mapping:

https://gist.github.com/thesmartshadow/256bff0f8042c584f993ace89074a815

From the root of a github.com/cilium/ebpf checkout:

chmod +x ghsa-btf-string-offset-gist/reproduce.sh
./ghsa-btf-string-offset-gist/reproduce.sh

Manual steps:

go run ghsa-btf-string-offset-gist/mutate_elf.go \
  -in cmd/bpf2go/testdata/minimal-el.elf \
  -out /tmp/cilium-ebpf-btf-nameoff-eq-stringlen.elf

go run ghsa-btf-string-offset-gist/worker_dos_poc.go \
  -input cmd/bpf2go/testdata/minimal-el.elf

go run ghsa-btf-string-offset-gist/variants_check.go \
  cmd/bpf2go/testdata/minimal-el.elf

Observed behavior:

  • the unmodified ELF fixture parses successfully
  • the mutated ELF differs by one 32-bit BTF string offset field
  • the malformed input causes a panic instead of a returned error
  • the worker PoC exits after parsing the malformed artifact
  • a follow-up benign artifact cannot be processed because the worker process is already gone

Key observed output includes:

control: one-shot scanner on benign input
exit_code: 0
stdout:
  ACCEPT 01-benign.elf

control: one-shot scanner on malformed ELF should reject, but currently panics
exit_code: 2
stderr:
  panic: runtime error: slice bounds out of range [376:375]

impact: long-running artifact scanner worker
worker_response: ACCEPT 01-benign.elf
worker_exit_code_after_malicious: 2
follow_up_write_error: write |1: file already closed
worker_process_state_exited: true

Activity

  1. added
    bug
    on May 26, 2026
  2. arunsingh commented on May 27, 2026

    @arunsingh
    Contributor

    I can take this.
    I reproduced the panic on current main and will send a small fix around the shared BTF string-table boundary check.

  3. thesmartshadow commented on May 27, 2026

    @thesmartshadow
    Author

    Thanks for taking this
    I retest the boundary cases once the fix is up

  4. witekest commented on Jun 18, 2026

    @witekest

    CVE-2026-10722 has been assigned to this issue.
    @dylandreimerink @ti-mo Could we get a new release including the bugfix, please?

  5. dylandreimerink commented on Jun 18, 2026

    @dylandreimerink
    Member

    @witekest It seems a bit odd to me to issue a CVE for this bug. I understand that technically you could see a panic in the go runtime as denial of service, specifically if you were to pass arbitrary user input into the library in lets say some sort of web application.

    But it feels like a very slippery slope to assign a CVE any time a user of the library can cause a panic by supplying "bad" input.

    I will discuss cutting a new release soon, depending on if there are any pending PRs we would like to be included in an upcoming version.

  6. ti-mo commented on Jun 24, 2026

    @ti-mo
    Contributor

    @thesmartshadow Why did you file a CVE for this bug? This report (the gist in particular) looks like slop from start to finish, we were not notified that this was coming down the pipeline (who did you disclose this to other than filing the CVE itself?), and assigning a medium CVSS for a panic in a bytecode parser that's not typically exposed to the outside world is a stretch to say the least.

    This looks like resume padding on your part and a bad use of maintainer resources as well as the CVE infrastructure. It doesn't give me more confidence in the system. Please rethink your approach going forward.

  7. thesmartshadow commented on Jun 24, 2026

    @thesmartshadow
    Author

    @ti-mo I’m fine with technical disagreement on scope or scoring, but I don’t accept the personal accusation.

    This was not presented as a generic “bad input causes panic” issue. The report documented a deterministic panic in the BTF parser through public parsing APIs, with a reproducible PoC, affected-version testing, and a narrow availability impact.

    Under the CVE CNA rules, availability impact is explicitly within scope for vulnerability determination, and assignment is based on reasonable evidence, public disclosure, CNA scope, and whether other parties need to assess risk. That is the basis on which I submitted it.

    The CVE was not self-issued. A CNA reviewed the evidence and accepted it. The project also had the public upstream issue and the bug was fixed upstream, so this was not an unsupported claim.

    Calling the report “resume padding” does not engage with the technical evidence or the CVE criteria. If the concern is wording or score, that is fair to discuss. But questioning intent is not a technical argument.

  8. ti-mo commented on Jun 24, 2026

    @ti-mo
    Contributor

    This was not presented as a generic “bad input causes panic” issue. The report documented a deterministic panic in the BTF parser through public parsing APIs, with a reproducible PoC, affected-version testing, and a narrow availability impact.

    I'm not sure where the distinction comes from or why that matters. It's a simple panic in a parser that typically doesn't handle untrusted user input, in a language with strict bounds checking. If this were an HTTP parser for a public endpoint, you'd have a valid point, but that's not really the case here. Thank you for reporting the bug, but please let's not pretend this is even in the vicinity of an 'exploit' or 'vulnerability', because it plain isn't.

    By submitting this bug as a CVE, you've failed to demonstrate good judgment on what constitutes a vulnerability. The Gist you posted somewhere is so contrived and verbose it could've only been generated by AI and doesn't communicate you fully understood what the API is being used for. These are the kinds of submissions that make e.g. curl maintainers close bug bounty programs due to low submission quality.

    As for the non-technical arguments question; I think it's absolutely fair and normal to question your intent here, and it's odd you'd think otherwise. As a contributor and/or submitter, you are a guest, and you don't operate in a vacuum. My main sticking point is that you did not communicate with us about your intention to submit a CVE at all. I initially found out about it after users started asking for a release while I was on a trip overseas, at which point the CVE had already been out for 2 weeks. If we'd have at least been aware (regardless of the CVE's merit), we could've responded appropriately to have a release ready by the time disclosure deadline happened.

    But we're not ready, our users are getting vulnerability notifications, and now we have to scramble to get something out the door for a benign fix, which is annoying busywork and not a good look on us. We ideally want our releases to include something of significance that at least fixes a concrete problem, but now we need everyone to perform a dependency bump just because CVE said so. As I mentioned before, this is not a good use of our and our users' resources.

    As a maintainer on the receiving end of this, I am allowed to call this out. In fact, everyone in the OSS ecosystem should feel compelled to do so, as this affects us all. To be candid, this feels like being milked for CVEs for your benefit. You did not have to file a CVE in order to receive credit for a bug report. Finding and reporting non-critical bugs is equally important for the health of any project, and contributors that dedicate their time chasing and fixing tricky bugs are typically highly-regarded.

    You clearly want to profile yourself as someone willing to make a (positive) impact on the industry and the Linux ecosystem, but that requires forging good relationships with maintainers first and foremost, which includes receiving feedback and collaborating. My inbox remains open should you want to reach out to this effect.

  9. locked and limited conversation to collaborators on Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions