fix(honeypot): route non-existent .php probes through nginx to the trap

nginx's `location ~ \.php$` fastcgi-passed EVERY .php path to php-fpm, which 404'd the classic
attacker probes (/wp-login.php, /xmlrpc.php, /admin.php, /vendor/…/eval-stdin.php) with 'File not
found' BEFORE they could reach the Laravel honeypot route — so those decoys never trapped behind
nginx (the feature tests hit the Laravel route directly, bypassing nginx, and missed this). Add
`try_files $uri /index.php?$query_string` to the php location so a non-existent .php falls through
to the front controller (only index.php actually exists in public/, so nothing else executes).
Verified through nginx: all .php + non-.php + dotfile decoys now serve the deceptive 200.
feat/v1-foundation
boban 2026-07-05 09:32:23 +02:00
parent 72de7b9a22
commit 1b3e058de6
1 changed files with 6 additions and 0 deletions

View File

@ -71,6 +71,12 @@ http {
error_page 404 /index.php; error_page 404 /index.php;
location ~ \.php$ { location ~ \.php$ {
# A .php request that is NOT a real file (e.g. an attacker probing /wp-login.php,
# /xmlrpc.php, /admin.php, /vendor/…/eval-stdin.php) must reach Laravel (the honeypot
# route) instead of returning php-fpm's "File not found" 404. Only index.php actually
# exists in public/, so this executes solely the front controller; every other .php
# falls through to /index.php and is routed by the app.
try_files $uri /index.php?$query_string;
fastcgi_pass 127.0.0.1:9000; fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;