External Control of File Name or Path in hascheksolutions/opentrashmail
Valid
Reported on
Jun 25th 2021
✍️ Description
Attackers can control the filesystem path argument to readfile()
at api.php
line 35 for ?email=
parameter, which allows them to access or modify otherwise protected files.
Analysis Trace:
- application take unsensitized input at:
$email = strtolower($_REQUEST['email']);
- Assigning user input to filepath:
$filepath = ROOT.DS.'..'.DS.'data'.DS.$email.DS.'attachments'.DS.$id.'-'.$filename;
- Finally read file at:
readfile($filepath);
🕵️♂️ Proof of Concept
1. Visit /api.php?action=attachment&email=\..\..\..\..\..\Windows\win.ini&id=valid_id&filename=valid_finalname where the GET variables were properly replaced, you can see arbitrary files on the serve.
💥 Impact
The program may give the attacker the ability to overwrite the specified file or run with a configuration controlled by the attacker. Arbitrary file read, leakage of information.
Occurrences
We have contacted a member of the
hascheksolutions/opentrashmail
team and are waiting to hear back
2 years ago
2 years ago
Hi Christian, I have submitted the patch for this. Please check.
Also, I have one pending issue, can you please validate it? :) Thanks! https://www.huntr.dev/bounties/1624705958693-HaschekSolutions/opentrashmail/
to join this conversation