Commit 696fe34e by Quentin Kaiser

fix path traversal in PFS extractor script.

os.path.join does not fully resolve a path so the condition that follows
will never be true. Fixed by resolving the path using os.path.abspath.
parent a555eb1f
......@@ -104,7 +104,7 @@ class PFSExtractor(binwalk.core.plugin.Plugin):
data = binwalk.core.common.BlockFile(fname, 'rb')
data.seek(fs.get_end_of_meta_data())
for entry in fs.entries():
outfile_path = os.path.join(out_dir, entry.fname)
outfile_path = os.path.abspath(os.path.join(out_dir, entry.fname))
if not outfile_path.startswith(out_dir):
binwalk.core.common.warning("Unpfs extractor detected directory traversal attempt for file: '%s'. Refusing to extract." % outfile_path)
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment