diff options
| author | 2026-07-16 15:42:01 -0600 | |
|---|---|---|
| committer | 2026-07-16 15:42:01 -0600 | |
| commit | 6c9350e48ff04d7ae8582374fb4e3439b50162d5 (patch) | |
| tree | 0a9feeb2576001ed007fc935fb6db2284c2c37e6 | |
| parent | add a noscript to the upload prompt (diff) | |
| download | hostfiles-6c9350e48ff04d7ae8582374fb4e3439b50162d5.tar.gz hostfiles-6c9350e48ff04d7ae8582374fb4e3439b50162d5.tar.bz2 hostfiles-6c9350e48ff04d7ae8582374fb4e3439b50162d5.zip | |
block application/x-www-form-urlencoded
| -rw-r--r-- | upload.php | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -13,7 +13,14 @@ if ($_SERVER['REQUEST_METHOD'] != 'POST' && $_SERVER['REQUEST_METHOD'] != 'PUT') } $c_t = strtolower($_SERVER['HTTP_CONTENT_TYPE'] ?? ''); -if ($c_t == 'multipart/form-data' || 0 === strpos($c_t, 'multipart/form-data;')) { +if ($c_t == 'application/x-www-form-urlencoded') { + header('Status: 415 Unsupported Media Type'); + header('Content-Type: text/plain'); + echo "You seem like a really dumb bot that doesn't check the enctype of the form before spraying common vulnerabilities.\n"; + echo "Content-Type: application/x-www-form-urlencoded is not supported.\n"; + send_notification("[hostfil.es] $_SERVER[REMOTE_ADDR] tried to $_SERVER[REQUEST_METHOD] $c_t"); + exit; +} elseif ($c_t == 'multipart/form-data' || 0 === strpos($c_t, 'multipart/form-data;')) { $FILES = remap_files(); if (!isset($FILES['file'])) { die_error("You need to upload the file within the field name 'file[]' (or 'file' if there's only one) if you want to use multipart/form-data.", '406 Not Acceptable'); |
