Skip to content

Test for malicious manifest on windows  #67

Closed

Description

@johnscancella

https://github.com/loc-rdc/bagitspec/blob/bagit1.0/bagit.xml#L783-L785

Windows implementations &should; test their implementations to ensure that safety-checks prevent use of drive letters and the less commonly used namespace sequences (e.g. "\?\C:\…") described in <xref target="MSFNAM"

Does the current set of tests, account for this adequately? If not we should create a windows only test for it.

Activity

  1. changed the title [-]https://github.com/loc-rdc/bagitspec/blob/bagit1.0/bagit.xml#L783-L785[/-] [+]Test for malicious manifest on windows [/+] on Dec 12, 2016
  2. acdha commented on Dec 12, 2016

    @acdha
    Member
  3. johnscancella commented on Dec 13, 2016

    @johnscancella
    ContributorAuthor

    I was thinking more about this, is this even a valid case with the fact that we only allow / as the path separator?

  4. acdha commented on Dec 13, 2016

    @acdha
    Member

    I think it's a good invalid test case: it's easy to imagine an implementation error where the library creates manifests using / as expected but passes everything else to the OS directly and on Windows, a path with / will be normally be transparently treated as if it used \ using the normal Win32 APIs.

    I think this is a minor problem for manifests – it could allow some information leakage about the existence of files or specific targeted versions – but more of an issue for fetch.txt where it could potentially allow overwriting a local file with an arbitrary URL in an automated pipeline.

  5. johnscancella commented on Dec 13, 2016

    @johnscancella
    ContributorAuthor

    if you type in //?/C:/ into windows it doesn't know what to do, it must use the \. So with that in mind I don't think it is even a good invalid test, it is just invalid. As for fetch.txt files, we can add a check to see if the destination is outside the bag just like we do with manifests.

  6. acdha commented on Dec 13, 2016

    @acdha
    Member

    Right, but if you put \\?\C:\ into a manifest or fetch.txt and something just passes it to a file open call without validation, you have a potential problem unless you validate the path before opening it.

  7. added a commit that references this issue on Dec 13, 2016
  8. nuest commented on Dec 14, 2016

    @nuest

    I did not check if that is covered by any already existing test, but what about file URIs, e.g. file://.. ?

    https://en.wikipedia.org/wiki/File_URI_scheme

  9. johnscancella commented on Dec 16, 2016

    @johnscancella
    ContributorAuthor
  10. added a commit that references this issue on Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions