-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: DOS when iterating over sections #370
Comments
Thanks for the report. PRs to fix this are welcome. |
To be clear, I'll gladly accept a PR that fixes this specific issue, but this isn't a high priority for me in any way. |
It's not a DoS if the only computer you've sabotaged is yours. pyelftools doesn't listen on a network - the DoS can't be triggered by a remote attacker. If the attacker already has the ability to execute arbitrary Python on your machine - you've got bigger problems. If a third party piece accepts binaries from untrusted callers and passes them to pyelftools uncritically - that's on the said piece. For an extended version of the same argument, see this: |
Applications using pyelftools are susceptible to DOS when parsing an ELF file whose
e_shentsize
is zeroe_shnum
is larger than the actual number of entries in the section header tableThe function
ELFFile.iter_sections
iterates overi in range(self['e_shnum'])
and yields sectionsat file offset
self['e_shoff'] + i * self['e_shentsize']
.If
e_shentsize
is zero this will return the first section over and over again.Thus a malicious ELF file can make pyelftools return the first section 9223372036854775808 times
and cause a DOS.
My question here is: Can you make pyelftools throw an exception if
e_shentsize
is zero because that would get rid of the DOS?An
e_shentsize
of zero doesn't make sense anyway.An exemplary ELF file that can trigger this can be found here: timeout-3561f873d79b09ce755b0981d3df30b9ac0ca0d3
The text was updated successfully, but these errors were encountered: