ScanElf: raw LIEF enums in header.flags crash format_event for ARM32/RISC-V ELFs (TypeError: __ne__)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 80/100
Research direction
Start in src/python/strelka/scanners/scan_elf.py and inspect how the ELF header flags are added to the scan event; the issue identifies the two fields that retain raw LIEF enums. Check the event formatting path in strelka/strelka.py and run the relevant scanner tests or reproduce with an ARM32 or RISC-V ELF. Done means these inputs scan without dropping the event and the emitted flags are serializable.
Written by the indexing model from the issue text.
Description
Summary
For ELF files whose header has non-zero processor flags (seen with 32-bit ARM EABI5 and RISC-V RVC/double-float binaries), the whole scan event is lost. ScanElf puts raw LIEF enum objects into the event, and format_event's cleanup lambda then raises:
File ".../strelka/strelka.py", line 1022, in format_event
remap2 = iterutils.remap(remap1, lambda p, k, v: v != "" and v != [] and v != {} and v is not None)
TypeError: __ne__(): incompatible function arguments. The following argument types are supported:
1. __ne__(self, arg: int, /) -> bool
2. __ne__(self, arg: lief._lief.ELF.PROCESSOR_FLAGS, /) -> bool
Invoked with types: lief._lief.ELF.PROCESSOR_FLAGS, str
The worker logs unknown exception (see traceback below), the file is moved to processed, and no result is emitted.
Cause
In src/python/strelka/scanners/scan_elf.py:
"flags": {
"flags_list": elf.header.flags_list,
"processor": elf.header.processor_flag,
These are the only header fields not converted with str(...). With current LIEF (nanobind bindings), comparing an enum to str raises instead of returning NotImplemented.
Suggested fix
"flags_list": [str(f).split(".")[-1] for f in elf.header.flags_list],
"processor": str(elf.header.processor_flag).split(".")[-1],
Optionally, make format_event's filter tolerant of non-comparable values (e.g. isinstance checks) so that one scanner field can't drop the whole event.
Impact
x86-64, i386 and AArch64 ELFs (processor flags 0) scan fine. 32-bit ARM, RISC-V and MIPS binaries, which is most IoT/router malware, silently produce no result. We hit it with three honeypot-captured samples (2× RISC-V 64, 1× ARM EABI5) out of 49; the x86/AArch64 samples in the same batch were all scanned.
Environment
- Strelka backend as bundled with Security Onion 3.3.0 (
so-strelka-backendcontainer) - Python 3.14
- LIEF 0.17.6
- Reproducible with any 32-bit ARM EABI5 ELF.
- Dominant language
- Python
- Stars
- 1k
- Forks
- 144
- Avg merge
- 14d 22h
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from target/strelka
-
[BUG] Archive scan results polluted by previous scannersPossibly taken @skalupa claimed this 278 days ago. Openbug
-
[REQUEST] Scanner based InsightsMay be free again @skalupa claimed this 605 days ago, and no pull request is open. Openenhancement
-
[REQUEST] Allow Strelka Clients to do Global Hash-Based De-duplicationMay be free again @ryanohoro claimed this 1147 days ago, and no pull request is open. Openenhancement
-
[REQUEST] Make Filestream Client Requests With No Logging AsynchronousMay be free again @ryanohoro claimed this 1147 days ago, and no pull request is open. Openenhancement
-
[BUG] 7za.exe matches cab_file flavorMay be free again @skalupa claimed this 763 days ago, and no pull request is open. Openbug
Similar issues
-
5-minutes algorithm all-levels any-language beginner-friendly community documentation easy first-timers-only good first issue hacktoberfest help wanted learning no-code-needed open-source python students
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Huerte/algo-solutions-python#281 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
LinkedEarth/Pyleoclim_util#718 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/flink-agents#1395 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pybamm-team/PyBaMM#6061 ·
Maintainers usually reply within 2 days
-
A wall-clock ceiling in test_rest_import_off_the_loop turns the gate red on unrelated pull requestsOpenbug help wanted quality
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pyrite-wiki/pyrite#1550 ·
Maintainers usually reply within 1 day