You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
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.
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.
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.
Activity
[-]https://github.com/loc-rdc/bagitspec/blob/bagit1.0/bagit.xml#L783-L785[/-][+]Test for malicious manifest on windows [/+]acdha commentedon Dec 12, 2016
@johnscancella We should probably have a known-invalid bag in https://github.com/loc-rdc/bagit-conformance-suite
johnscancella commentedon Dec 13, 2016
I was thinking more about this, is this even a valid case with the fact that we only allow
/as the path separator?acdha commentedon Dec 13, 2016
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.txtwhere it could potentially allow overwriting a local file with an arbitrary URL in an automated pipeline.johnscancella commentedon Dec 13, 2016
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.acdha commentedon Dec 13, 2016
Right, but if you put
\\?\C:\into a manifest orfetch.txtand something just passes it to a file open call without validation, you have a potential problem unless you validate the path before opening it.refs #67 - added a bunch of tests for possible malicious paths in fet…
nuest commentedon Dec 14, 2016
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
johnscancella commentedon Dec 16, 2016
@nuest see 30669a0
refs #67 - update conformance tests with windows and linux only inval…