Open Xhoenix opened 1 month ago
Thanks for the report! I can reproduce this with pyelftools.
1.Build the snap to create the problematic binary (or use the base64 encoded copy of it below)
snapcraft
Grab the binary
lxc --project snapcraft file pull <name of lxc container>/root/prime/opt/metasploit-framework/embedded/framework/data/templates/template_x86_linux_dll.bin
run pyelftools
>>> with pathlib.Path("template_x86_linux_dll.bin").open("rb") as file:
... elf_file = elffile.ELFFile(file)
... for section in elf_file.iter_sections():
... pass
...
File "<stdin>", line 3, in <module>
File "/home/developer/dev/snapcraft/.venv/lib/python3.12/site-packages/e
lftools/elf/elffile.py", line 174, in iter_sections
section = self.get_section(i)
^^^^^^^^^^^^^^^^^^^
File "/home/developer/dev/snapcraft/.venv/lib/python3.12/site-packages/e
lftools/elf/elffile.py", line 141, in get_section
return self._make_section(section_header)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/developer/dev/snapcraft/.venv/lib/python3.12/site-packages/e
lftools/elf/elffile.py", line 659, in _make_section
return DynamicSection(section_header, name, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/developer/dev/snapcraft/.venv/lib/python3.12/site-packages/e
lftools/elf/dynamic.py", line 237, in __init__
stringtable = elffile.get_section(header['sh_link'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
File "/home/developer/dev/snapcraft/.venv/lib/python3.12/site-packages/e
lftools/elf/elffile.py", line 619, in _get_section_header
return struct_parse(
^^^^^^^^^^^^^
File "/home/developer/dev/snapcraft/.venv/lib/python3.12/site-packages/e
lftools/common/utils.py", line 43, in struct_parse
return struct.parse_stream(stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/developer/dev/snapcraft/.venv/lib/python3.12/site-packages/e
lftools/construct/core.py", line 190, in parse_stream
return self._parse(stream, Container())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/developer/dev/snapcraft/.venv/lib/python3.12/site-packages/e
lftools/construct/core.py", line 635, in _parse
if "<obj>" in context:
^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded
> base64 template_x86_linux_dll.bin
f0VMRgEBAQAAAAAAAAAAAAMAAwABAAAA9gAAADQAAAB0AAAAAAAAADQAIAACACgAAgABAAEAAAAA
AAAAAAAAAAAAAADvvq3e776t3gcAAAAAEAAAAgAAAAcAAADEAAAAxAAAAMQAAAAwAAAAMAAAAAAQ
AAABAAAABgAAAAAAAADEAAAAxAAAADAAAAAAAAAAAAAAAAgAAAAHAAAAAAAAAAMAAAAAAAAA9AAA
APQAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAD2AAAABQAAAPQAAAAGAAAA9AAAAAoAAAAAAAAA
CwAAAAAAAAAAAAAAAAAAAAAA
As a workaround, you should be able to disable the linter.
lint:
ignore:
- library
I see a bug upstream, it looks like it's about to celebrate its 10 year anniversary: https://github.com/eliben/pyelftools/issues/60
Unfortunately, ignoring the troublesome file from the linter does not fix the problem.
Snapcraft needs to:
Thank you for reporting us your feedback!
The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3190.
This message was autogenerated
Bug Description
Metasploit Framework builds are failing due to the following error:-
To Reproduce
Launchpad builds are failing as can be seen in the build log attached below.
Environment
The snapcraft library linter fails to lint libraries of Metasploit Framework due to the above error.
snapcraft.yaml
Relevant log output
The complete build log can be seen here.
Additional context
No response