Skip to content

Conversation

@devttys0
Copy link
Collaborator

@devttys0 devttys0 commented Sep 5, 2021

Extracted archives could create symlinks which point anywhere on the file system, potentially resulting in a directory traversal attack if subsequent extraction utilties blindly follow these symlinks. More generically, Binwalk makes use of many third-party extraction utilties which may have unpatched security issues. This branch addresses these issues by:

  • Sanitizing symlinks that point outside of the extraction directory by changing the symlink target to os.devnull. A warning is displayed to the end user, which includes the path to the offending symlink as well as the original symlink target. Symlink sanitization can be disabled by the end user if desired.
  • Providing a --run-as command line option, which specifies a user account to run third-party extraction utilities under (requires Binwalk itself to be run as root).
  • Refusing to perform extraction as root unless --run-as=root is specified.
  • Adding a notice in the README pertaining to these issues and changes.
  • Adding an explicit test for relative and absolute symlink directory traversal attempts.
@devttys0 devttys0 self-assigned this Sep 5, 2021
@devttys0 devttys0 marked this pull request as draft September 6, 2021 13:56
@devttys0 devttys0 marked this pull request as ready for review September 6, 2021 14:57
@eacmen eacmen merged commit fa0c0bd into master Sep 10, 2021
@eacmen eacmen deleted the unpriv_user_exec branch September 10, 2021 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants