Skip to content

Commit 45350be

Browse files
authored
Update README.md
1 parent 1ff304a commit 45350be

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/pentesting-web/file-upload/README.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ Then hit the saved path (typical in Laravel + LFM):
8888
GET /storage/files/0xdf.php?cmd=id
8989
```
9090

91-
Mitigations:
92-
- Upgrade unisharp/laravel-filemanager to ≥ 2.9.1.
93-
- Enforce strict server-side allowlists and re-validate the persisted filename.
94-
- Serve uploads from non-executable locations.
95-
9691
### Bypass Content-Type, Magic Number, Compression & Resizing
9792

9893
- Bypass **Content-Type** checks by setting the **value** of the **Content-Type** **header** to: _image/png_ , _text/plain , application/octet-stream_
@@ -432,11 +427,6 @@ Notes
432427
- The payload file must still pass server‑side magic/MIME sniffing. Embedding the PHP in a PDF stream keeps the header valid.
433428
- Works where the enum/validation path and the extraction/write path disagree on string handling.
434429

435-
Mitigations
436-
- Reject any archive with NULs in entry names; normalize and canonicalize names prior to validation.
437-
- Use a single, consistent library for enumeration and extraction; never mix parsers.
438-
- Store uploads on non-executable storage; never serve directly from the extraction path.
439-
440430
### Stacked/concatenated ZIPs (parser disagreement)
441431

442432
Concatenating two valid ZIP files produces a blob where different parsers focus on different EOCD records. Many tools locate the last End Of Central Directory (EOCD), while some libraries (e.g., ZipArchive in specific workflows) may parse the first archive they find. If validation enumerates the first archive and extraction uses another tool that honors the last EOCD, a benign archive can pass checks while a malicious one gets extracted.
@@ -460,11 +450,6 @@ Abuse pattern
460450
- Concatenate them: `cat benign.zip evil.zip > combined.zip`.
461451
- If the server validates with one parser (sees benign.zip) but extracts with another (processes evil.zip), the blocked file lands in the extraction path.
462452

463-
Mitigations
464-
- Reject archives with trailing bytes or multiple EOCDs; verify exactly one well‑formed archive.
465-
- Use the same parser for validation and extraction.
466-
- Disallow server‑side extraction to web‑served, executable folders; prefer offline processing with strict allowlists.
467-
468453
## ImageTragic
469454

470455
Upload this content with an image extension to exploit the vulnerability **(ImageMagick , 7.0.1-1)** (form the [exploit](https://www.exploit-db.com/exploits/39767))
@@ -522,4 +507,4 @@ How to avoid file type detections by uploading a valid JSON file even if not all
522507
- [Microsoft – mklink (command reference)](https://learn.microsoft.com/windows-server/administration/windows-commands/mklink)
523508
- [0xdf – HTB: Certificate (ZIP NUL-name and stacked ZIP parser confusion → PHP RCE)](https://0xdf.gitlab.io/2025/10/04/htb-certificate.html)
524509

525-
{{#include ../../banners/hacktricks-training.md}}
510+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)