Sitelet https://github.com/python/cpython/issues/99889
Skip to content

Directory traversal in uu module / uu.decode #99889

Description

@hannob

Bug report

The function uu.decode is vulnerable to trivial directory traversal if no output filename is given. An uu-encoded file with a path starting with a repetition of ../../ or a / allows writing a file to an arbitrary location on the filesystem.

I reported this to security@python.org and was asked to report it publicly as the function is rarely used and removal is planned anyway for Python 3.13.

Your environment

CPython versions tested on: 3.10.8
Operating system and architecture: Linux

example files

Case 1:

begin 644 ../../../../../../../../tmp/test1
$86)C"@``
`
end

Case 2:

begin 644 /tmp/test2
$86)C"@``
`
end

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Nov 30, 2022
  2. added a commit that references this issue on May 2, 2023
  3. added
    stdlibStandard Library Python modules in the Lib/ directory
    on May 2, 2023
  4. self-assigned this
    on May 9, 2023
  5. added a commit that references this issue on May 9, 2023
  6. added 5 commits that reference this issue on May 9, 2023
  7. added 2 commits that reference this issue on May 9, 2023
  8. added 2 commits that reference this issue on May 22, 2023
  9. added a commit that references this issue on May 27, 2023
  10. added a commit that references this issue on Jun 22, 2023
  11. alittlesir commented on Jun 27, 2023

    @alittlesir

    The permission on the uu.py file is changed from 755 to 644. Is this a misoperation? Why change this permission?

  12. arhadthedev commented on Jun 27, 2023

    @arhadthedev
    Member

    @alittlesir Could you file a new issue, please? Here is a chance that core developers do not track the solved ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errortype-securityA security issue

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions