The scanner says the upload accepted a .php file. Did anything execute it? File upload as a DAST finding: accepted, stored, served and executed, what extension, Content-Type and magic-byte checks let through, how Apache and nginx handler mapping decides execution, the .htaccess upload, SVG and HTML as stored XSS, and what each piece of evidence proves

DedSec Security Research ·

Here is a hypothetical. A dynamic scan of several PHP applications returns four results about file upload. The first is "Unrestricted file upload", rated critical, on a profile-picture endpoint. The scanner posted a file named shell.php and got a 200 with {"ok": true}. The team escalates it as remote code execution. The second, on a document endpoint in a different application, is "Upload filter bypass via double extension": shell.php.jpg was accepted. The team confirms the server is Apache, knows that Ubuntu's PHP configuration only runs names that end in .php, .phtml or .phar, and closes it as a false positive. The third is "Stored XSS via SVG upload", rated medium. The team points out that every response carries X-Content-Type-Options: nosniff and closes it. The fourth is an old finding. After a real shell upload last quarter, the team added SetHandler none to the Apache <Directory> block for the uploads folder, reviewed the change and closed the finding.

As in the earlier posts in this series, each decision rests on the finding's title and on a belief about the server, not on what the scanner observed and what that observation can prove. We rebuilt each situation in a lab. The 200 in the first finding proved that the request was accepted and nothing else: in our version of that endpoint the file was stored outside the web root, and the only URL that returned it sent it as a download. The team's reasoning on the second matched Ubuntu's stock configuration exactly, and on the same Apache build with one older-style handler line, the same shell.php.jpg ran as PHP. The third was a true positive that nosniff did nothing to stop: Chromium ran the script inside an SVG served as image/svg+xml with nosniff set, and the script read the session cookie. And the fourth fix did not work. With SetHandler none in the <Directory> block, shell.php uploaded to that folder still executed, because the stock <FilesMatch> handler is applied after <Directory> blocks.

This post is for whoever is holding a file upload finding from a dynamic scan, or a clean result they are about to rely on. It covers:

It is the twentieth post in a series about confirming DAST findings. The earlier ones cover reflected XSS, SQL injection, OS command injection, Nuclei template matches, ffuf content discovery, path traversal, open redirect, SSRF through URL-fetch parameters, XXE, CRLF header injection, Host header injection, HTTP request smuggling, CORS misconfiguration, JWT validation, Arjun parameter discovery, server-side template injection, CSRF, GraphQL and NoSQL injection. File upload borrows from three of them. Execution evidence is the same problem as in the command injection post, a file served to a browser is the stored form of the XSS post, and a filename with ../ in it is the path traversal post with a write instead of a read.

Sources, and how each was checked. We made the measurements below on our test machine on the morning of 12 November 2026, India time (between 01:25 and 01:38 UTC). It runs Ubuntu 24.04.4 on a virtual machine with two vCPUs of an AMD EPYC 9354P. Every server, script and browser ran as a non-root user inside a Linux network namespace whose only interface was loopback. Before each run we checked the isolation: the name example.com did not resolve and a TCP connection to 1.1.1.1 failed. The software was:

nginx, Python and Chromium were already on the machine. Apache and PHP were not. We downloaded their Ubuntu packages once from the Ubuntu archive with apt-get download, on the host network, and unpacked them into the lab directory with dpkg -x. They were not installed, no system service was started, and their checksums are recorded in the lab. Nothing in the lab itself reached any other host.

The vulnerable handlers are deliberate lab constructs. The lab has one PHP upload handler with eight validation modes, each written to reproduce a pattern on purpose: no checks at all; trusting the Content-Type the client put on the file part; sniffing magic bytes with fileinfo; a case-sensitive blocklist of .php; a regex that accepts any name containing an image extension; an allowlist on the last extension; the same allowlist with a random server-side name; and a mode that builds the storage path from PHP's full_path field. Three more modes store differently: one decodes the image and re-encodes it as PNG, one returns 200 and keeps nothing, and one stores the file outside the web root under a random id. No real application should ship any of the first eight. Every request the handler received is logged with the filename PHP gave it, so each result below is matched to what the handler actually saw.

The server configurations are listed where they are used. We read Ubuntu's stock Apache PHP configuration, nginx's snippets/fastcgi-php.conf and PHP-FPM's default pool file from the packages, and the quotations from them below were checked against those files. We did not fetch Apache, nginx, PHP or browser documentation for this post. Where we describe what a server or browser does, it is what it did in the lab. We did not run any scanner, Nuclei template or upload-testing tool. The opening scenario is hypothetical. The numbers measure our lab, one build of each server and one browser, and none of them measures AppSecD or how any product tests file upload.

Four facts: accepted, stored, served, executed

An upload finding is a claim about a chain, and each link is a separate fact with its own evidence.

  1. Accepted. The server took the request and said yes. Evidence: the upload response.
  2. Stored. The bytes were written somewhere, under some name. Evidence: something that reads them back.
  3. Served. A URL returns those bytes, with response headers that decide how a client treats them. Evidence: a GET of that URL, and its headers.
  4. Executed. Something interpreted the bytes as code. That might be the web server's handler running PHP, or a browser running script in the uploader's origin. Evidence: output that only execution can produce.

A 200 on the upload proves the first fact. In the lab, two modes returned 200 for a PHP file and never served it from the upload directory. The discard mode answered {"ok": true} and wrote nothing, and a GET of /uploads/d1.php returned 404. The private mode wrote the file outside the web root under a random id. The file was not under /uploads/ (a test file stored this way returned 404 there), and the only route to it was a download script that sent Content-Type: application/octet-stream, Content-Disposition: attachment and nosniff. Chromium downloaded that response as download.bin and did not render it.

Neither is proof the endpoint is fine. In the second case the application still stored a stranger's bytes, which matters if anything later reads them: an admin preview, a thumbnailer, a virus scanner, a document converter. But neither is the critical finding the title described, and the evidence for that has to come from a later request.

Execution splits further. Code execution on the server is one finding. Script execution in a browser is another, and it needs a different kind of evidence: a page load, not a server response.

Where the file lands, and how to find its URL

A multipart upload carries a filename in the part's Content-Disposition header, for example filename="shell.php". That name belongs to the client. What the server does with it is up to the application, and there are three possible outcomes:

PHP itself changes the name before the handler sees it. In PHP 8.3.6, $_FILES['f']['name'] for a part named ../t-none.php was t-none.php, and for ..\t-bs.php it was t-bs.php. PHP removed everything up to the last slash or backslash. The handler that saved under that name wrote into uploads/, and /t-none.php at the web root returned 404. PHP also keeps the original in a second field, full_path, which it filled with ../t-none.php. That field is covered in the traversal section below, because it undoes the stripping.

For a scanner the practical consequence is this. When the response does not say where the file went, the scanner has to guess the URL, and a wrong guess looks exactly like a file that was never stored. A clean upload result from a scan should say which of the three outcomes it observed. "Uploaded, then 404 at the guessed path" is not evidence that the file is unreachable.

What the handler checked, measured

The handler modes were run on the stock Ubuntu Apache configuration (A1 in the next section) unless stated otherwise, with the same 56-byte PHP file as the payload except in the two polyglot rows: <?php echo "UPL-" . (1336+1) . "-" . strrev("kram"); ?>. When it executes, it prints UPL-1337-mark. That string does not appear in the source, which contains 1336+1 and kram instead. So a fetched response that contains UPL-1337-mark proves execution, and one that contains 1336+1 proves the source was served as data.

ModeFilename sentUploadFetched result
Client Content-Typec1.php, part type image/png200executed
Client Content-Typec2.php, part type application/x-php415-
Magic bytes (fileinfo)m1.php, plain PHP415, sniffed text/x-php-
Magic bytes (fileinfo)m2.php, GIF89a then PHP200executed
Magic bytes (fileinfo)m3.php, a real JPEG with PHP in a comment segment200executed
Blocklist of .phpb1.php415-
Blocklist of .phpb2.PhP200source, no Content-Type
Blocklist of .phpb3.phtml, b4.phar200executed, both
Blocklist of .php.htaccess200403 on fetch
Name contains an image extensionk1.jpg.php200executed
Name contains an image extensionk2.php.jpg200source, image/jpeg
Allowlist on last extensionl1.php.jpg, l5.php.JPG200source, image/jpeg
Allowlist on last extensionl2.jpg.php, l4.PHP, .htaccess415-
Allowlist on last extensionl3.php, NUL byte, .jpg415-

Four things follow from that table.

The part's Content-Type is a claim the client makes. Our lab client wrote image/png on a PHP file and the check believed it. A check on that header is a check on what the client says the file is.

Magic bytes say what a file starts with, not what it is. fileinfo called the GIF polyglot image/gif and the JPEG polyglot image/jpeg. Both were stored under a .php name, and both ran: the GIF one returned 20 bytes, GIF89a, a newline and UPL-1337-mark. PHP prints anything outside <?php ... ?> as literal text and runs what is inside, so a valid image header in front of code is harmless to the interpreter. A magic-byte check only helps when the stored name is also forced to an extension the server will not execute.

Blocklists miss names the server treats as code. The case-sensitive blocklist stopped b1.php and let .phtml and .phar through, and on this server both of those executed. It also let .htaccess through. b2.PhP did not execute here, for a reason that belongs to the server, not to the blocklist.

The NUL byte did not get past anything. The filename l3.php, then a NUL, then .jpg arrived in $_FILES as l3.php. PHP 8.3.6 cut the name at the NUL before the handler saw it, so the extension check saw php and refused it. In the execution matrix below, the same trick under the no-check mode stored a file called shell.php. The classic bypass needed the check to see the whole string while a C-level filesystem call stopped at the NUL. In this build both sides see the same name. PHP 8.3.6 also refuses a NUL inside a path outright: file_put_contents() and fopen() both threw ValueError: ... must not contain any null bytes. Against this PHP version, then, a NUL-byte payload is of historical interest. We did not test other languages or older PHP versions.

The trailing-dot and trailing-space names in the execution matrix were stored exactly as sent, as shell.php. and shell.php (with a space). On Linux those are ordinary filenames. As general background, not tested here: Windows path handling strips trailing dots and spaces, which is where those tricks come from. We did not test Windows or IIS.

How the server decides execution

Whether a stored file runs is not a property of the file. It is decided by the web server's handler mapping, at the moment someone requests the URL. The same bytes under the same name can run on one server and be served as data on another.

We uploaded thirteen filenames, each containing the marker payload, through the no-check mode to twelve server profiles, and fetched each one back: 156 uploads, all accepted. The profiles were:

"exec" means the response contained UPL-1337-mark. "src" means it contained the source.

FilenameA1A2A3A4A5A6A7N1N2N3N4N5
shell.phpexecexecexecexecsrcsrcsrcexecexecexecexecsrc
shell.phtmlexecsrcexecexecsrcsrcsrcsrcsrcsrcsrcsrc
shell.pharexecsrcexecexecsrcsrcsrcsrcsrcsrcsrcsrc
shell.php5srcsrcsrcsrcsrcsrcsrcsrcsrcsrcsrcsrc
shell.PhP, shell.pHpsrcexecsrcsrcsrcsrcsrcsrcsrcsrcsrcsrc
shell.php.jpgsrcexecsrcsrcsrcsrcsrcsrcsrcsrcsrcsrc
shell.jpg.phpexecexecexecexecsrcsrcsrcexecexecexecexecsrc
shell.php.xyzsrcexecsrcsrcsrcsrcsrcsrcsrcsrcsrcsrc
shell.php. (trailing dot)srcexecsrcsrcsrcsrcsrcsrcsrcsrcsrcsrc
shell.php plus a trailing spacesrcsrcsrcsrcsrcsrcsrcsrcsrcsrcsrcsrc
shell.php, NUL byte, .jpg (stored as shell.php)execexecexecexecsrcsrcsrcexecexecexecexecsrc
shell.jpgsrcsrcsrcsrcsrcsrcsrcsrcsrcsrcsrcsrc

35 of the 156 uploads executed. What decides each column:

Ubuntu's stock Apache block is anchored and case-sensitive. On A1, the regex ends in $, so .php.jpg, .php.xyz and the trailing dot did not match and were served as data. It has no case-insensitive flag, so .PhP did not match. But it does include .phar and .phtml, so a blocklist that only knows .php is not enough on a stock Ubuntu Apache. .php5 did not execute anywhere in the lab.

AddHandler works on every extension in the name. On A2, with the older AddHandler line, a .php anywhere among the name's extensions was enough. shell.php.jpg, shell.php.xyz and shell.php. all ran, and the match ignored case, so .PhP and .pHp ran too. Meanwhile .phtml and .phar were served as source, because that line only names .php. On this profile the allowlist-on-last-extension mode, which is a reasonable check, accepted l1.php.jpg and l5.php.JPG and both executed. The same two files were inert on A1. So the second finding in the opening scenario cannot be closed by reasoning about "Apache". It depends on which handler line that virtual host actually has.

SetHandler none in a <Directory> block did not stop the stock handler. A4 executed everything A1 did. The result is consistent with Apache applying <Files> and <FilesMatch> sections after <Directory> sections, so that the stock <FilesMatch> set the PHP handler again after the directory block had cleared it. We did not fetch Apache's documentation for this post, so that ordering is stated as what the lab showed. It is why the fourth finding in the opening scenario was still open. Three other placements did stop it. A5's php_admin_flag engine off turned the PHP engine off for the directory. A6 nested a <FilesMatch> inside the <Directory>. A7 used <Location>, which in the lab overrode the stock <FilesMatch>. None of the three executed anything.

nginx decides by location, and a prefix location does not protect a directory from a regex location. In N1 the regex \.php$ matched /uploads/shell.php and /uploads/shell.jpg.php and sent them to PHP-FPM. Nothing else ran, because the regex is anchored and case-sensitive (~, not ~*), and nginx served .phtml, .phar and .PhP as application/octet-stream. N4 added a plain location /uploads/ { }, and shell.php still executed: the regex location still won. N5 marked its prefix location ^~, and N5 executed nothing.

PHP-FPM's security.limit_extensions is what stopped the old nginx bug. The old nginx pattern passes /uploads/shell.jpg/x.php to PHP, because the URL ends in .php. That file does not exist, and with cgi.fix_pathinfo=1 PHP walks back along the path to shell.jpg and treats the rest as PATH_INFO. On N2, with the default pool, both /uploads/shell.jpg/x.php and /uploads/shell.jpg/.php got 403 Access denied.. The pool file's default, quoted from the package, is ;security.limit_extensions = .php .php3 .php4 .php5 .php7. On N3, whose pool allowed .jpg, both URLs returned UPL-1337-mark from a file named shell.jpg. Ubuntu's snippet in N1 has try_files $fastcgi_script_name =404;, and N1 returned 404 for both. So a finding that says "image executed as PHP via path info" on nginx is a claim about two settings at once, and only a fetch shows which one is wrong.

A file that does not execute is not served safely by default. Look at how the "src" cells were served. Apache sent no Content-Type at all for names it had no type for: .php5, .PhP, the trailing dot, the trailing space, and .php itself on A5 and A7, where the PHP handler no longer claimed it. nginx and Python's http.server sent application/octet-stream for unknown extensions. The difference matters, and the browser section shows why.

The .htaccess upload

If Apache honours .htaccess files in the uploads directory, an attacker who can upload one can change the handler mapping for every file next to it. We uploaded two versions through the no-check mode, then uploaded the marker payload as a .jpg and fetched it:

On A3, which had AllowOverride All on the uploads directory, both versions made the .jpg execute. On A1, A2, A5 and A7, which have AllowOverride None, neither did: the .jpg came back as source with image/jpeg. On all five profiles a GET of /uploads/.htaccess returned 403, because every Apache profile in the lab included a <FilesMatch "^\.ht"> Require all denied block. That is what a scanner sees: an accepted upload of a file it cannot fetch back. Whether the .htaccess took effect only shows up when a second, ordinary-looking file executes.

Two consequences for triage. A blocklist that does not include .htaccess is a finding on any Apache where AllowOverride permits handler directives in that directory. And confirming it takes two uploads and a fetch. The upload of .htaccess on its own proves nothing, because on four of these five profiles it was accepted and ignored. We did not test A5 with AllowOverride enabled.

Object storage and static directories

Code execution needs an interpreter that is mapped to the file. An upload written to a bucket in an object store and served from there, or served by a server that has no PHP handler at all, is data. In the lab, Python's http.server served shell.php and shell.phtml as application/octet-stream, source and all, and nginx's N5 location did the same for every name. A scanner that reports remote code execution against a file it fetched from a static origin is reporting the wrong class.

The wrong class is not the same as no finding: what the browser does with the file, the next section, still applies. We did not test any object store. By the same mechanism, the Content-Type and Content-Disposition the store sends take the place of the web server's in everything below.

Not executed on the server, executed in the browser

Stored XSS through an upload needs three things. The file holds script, a browser loads it as a document, and that document runs in an origin that is worth attacking. We tested the second part with Chromium 153.0.8010.12, using a small lab server that serves the same file with whatever response headers a query string asks for. The first column is the Content-Type the response sent.

Served asSVG with scriptHTML with script
Its own type (image/svg+xml, text/html)ranran
Its own type, plus nosniffranran
Its own type, plus Content-Disposition: inlineranran
Its own type, plus Content-Disposition: attachmentdownloadeddownloaded
text/htmlranran
application/xml or text/xmlranXML parse error
image/svg+xmlranXML parse error
text/plain, with or without nosniffshown as textshown as text
No Content-Typeshown as textran
No Content-Type, plus nosniffshown as textshown as text
application/octet-streamdownloadeddownloaded
image/png, with or without nosniffimage document, no scriptimage document, no script
SVG loaded through <img src>did not runn/a

In every "ran" cell, the script read document.cookie and got the session cookie set by the lab's application origin.

nosniff does not stop a response whose declared type is executable. It changes what a browser does when it would otherwise guess. With a correct image/svg+xml or text/html, the SVG and the HTML ran with nosniff and without it. That is the third finding in the opening scenario. The security headers post covers what nosniff does in general. In this lab the only case where it changed the result was an HTML file served with no Content-Type. Without nosniff, Chromium sniffed it as HTML and ran it. With nosniff it showed the file as text.

No Content-Type was the dangerous default. That is what Apache sent for many of the uploads it did not execute, including .PhP, .php5, the trailing dot and space, and .php on A5 and A7. We uploaded the HTML payload as nct.PhP on A1, and as nct.php on A5 and on A7. Apache served all three with no Content-Type, and Chromium sniffed each as HTML and ran its script with the application's cookie. A6 served the same file with nosniff and Content-Disposition: attachment, and Chromium downloaded it. So the A5 and A7 fixes stopped code execution on the server and left stored XSS in the browser. On this Apache, a fix for the uploads directory needs both halves.

Content-Disposition: attachment stopped rendering on navigation every time we sent it. Every response that carried it was downloaded: the SVG and the HTML with their own types, A6's response with no Content-Type, and the download script's application/octet-stream. An <img> does not run SVG script either, so an SVG that is only ever displayed through <img> is not the risk. The risk is the direct URL, which anyone can send someone.

The scanner's payload has to be valid XML. Our first SVG payload had a bare & inside its script. That is valid in HTML and invalid in XML, and Chromium showed an XML parse error page and ran nothing. With the script wrapped in <![CDATA[ ... ]]>, the same file ran. A scanner whose SVG payload is malformed will report an SVG endpoint clean when it is not.

A separate origin isolates cookies only if it is a separate host. The application set a host-only cookie on app.lab.test:8400. An SVG on app.lab.test:8401, a different origin by port, still read that cookie, because cookies do not separate by port. The same SVG on files.labusercontent.test:8400 ran with an empty document.cookie. Serving user content from a different registrable domain is the structural fix for script in uploads. A different port on the same host is not. We tested a host-only cookie. As general cookie behaviour, not tested here, a cookie set with a Domain attribute reaches every subdomain under that domain, which is why the separate host should be a separate registrable domain rather than a subdomain.

Path traversal in the filename

If the filename is used to build the storage path, ../ in it moves the write. PHP's name field stripped the path in the lab, as described above. But PHP 8.3.6 also exposed the unstripped value in full_path, a field PHP added for directory uploads (from general knowledge; we did not check the PHP changelog). The lab's full_path mode built the path from it:

The second line is the important one. Every per-directory defence in the execution section assumes the file lands in that directory. A traversal in the filename moves it somewhere the defence does not cover, so a traversal finding on an upload endpoint is worth more than its read-only cousin in the path traversal post. The evidence is the same kind: a marker file that appears at a path the application should never write to, fetched back. A scanner cannot see a write outside the web root at all, unless the file lands somewhere it can fetch.

Polyglots, and re-encoding as a defence

A polyglot is a file that is valid as two formats at once. The lab's JPEG polyglot is a real 16 by 16 JPEG made with GD, with the PHP marker inserted as a comment segment straight after the start-of-image marker. The file utility called it JPEG image data, and fileinfo called it image/jpeg. Stored as .php on A1 it executed. That is the point of a polyglot: it passes a content check, and what happens next is again decided by the name and the server.

Re-encoding changes that. The lab's re-encode mode decodes the upload with GD and writes a new PNG under a random name. For the JPEG polyglot, the stored PNG contained neither 1336 nor php. The decoder reads pixels and ignores the comment, and in the lab the comment did not reach the output. The GIF polyglot, which is only a GIF header followed by PHP, was sniffed as image/gif and then refused with 415, because GD could not decode it. Re-encoding is a strong control because it rebuilds the file from what the format means rather than from what the file contains. It is not unconditional. Payloads built to survive a particular encoder's output, for example in compressed pixel data, are a known technique, and we did not test one. Combined with a server-chosen name and extension, it removed the execution path for the polyglot we tested, and it removes the SVG path because the output is never SVG.

Size and archives

An upload endpoint can also be a denial of service: a large file, many files, or an archive that expands to far more than it weighs if something unpacks it. These are real findings, but they are not confirmed the way the rest of this post is. The evidence is resource consumption on the target, and producing it means degrading the target. We did not test them, and they are out of scope here beyond saying that a scanner should not try to prove them against production.

What evidence confirms each class

And the false positives:

And one negative that is not a false positive: an SVG or HTML payload that did not run might simply be malformed, as ours was the first time.

Confirming a finding by hand

The procedure below is general practice. It needs authorisation to test the target, should use files that do nothing harmful when they run, and should clean up after itself.

  1. Read the upload response. Status, body, and any URL, id or filename it returns. A 200 with an error in the body is a refusal.
  2. Find the stored file. Use the URL from the response. Failing that, look at the page that displays the upload. Only guess a path as a last resort. Record whether the server kept your name or chose its own.
  3. Fetch it and keep the headers. Status, Content-Type, Content-Disposition, nosniff, and the host it is served from. This decides the browser question before you open a browser.
  4. Test execution with a computed marker. Upload a file whose output differs from its source, such as an arithmetic result, under the names the handler accepts. Fetch it. Output means execution, source means data.
  5. Probe the handler mapping, not just the check. For each name the check accepts, such as .php.jpg, .phtml, .phar or a case variant, fetch it and see what the server does with it. If .htaccess is accepted, upload a harmless one that maps a test extension, then a file with that extension, and fetch the second file.
  6. Use an out-of-band marker where output may not come back. A unique token per attempt, to a listener you control.
  7. For SVG and HTML, load the URL in a browser. Use a script that only records its origin and whether it can see a test cookie. Also try the same file through <img> if that is how the application displays it, to show the difference.
  8. Check the filename for traversal. Send ../ in the filename and look for the file outside the upload directory. Remember that the framework may strip the name and keep the original elsewhere, as PHP's full_path does.
  9. Delete what you uploaded, or record where it is so the owner can.

The fix

All of this is general practice, except where it says it was measured.

The static side

Some of this is visible in source and configuration, and some is not. Static analysis can see a move or write whose destination is built from the client's filename or from full_path, an extension check against a blocklist, a check on the client's Content-Type, a check with no case folding, and the absence of a check altogether. Configuration scanning can see an AddHandler line for PHP, AllowOverride on a writable directory, an nginx PHP location without try_files or with ~*, and a changed security.limit_extensions. Those are real, checkable facts.

What a rule cannot easily see is the combination. The allowlist-on-last-extension mode is correct code that is safe on A1 and executes on A2. A rule that flags the handler will flag it on both. One that trusts it will miss A2. A rule that sees SetHandler none in the uploads directory would have to model Apache's section-merge order to know it does nothing on A4. That is the sanitiser-credited-against-the-wrong-sink problem from the SAST false-positive post, moved into configuration. We did not run a static rule or a configuration scanner against the lab.

What source and configuration do not show at all:

A triage checklist for a DAST file upload finding

  1. Which of the four facts did the scanner observe? Accepted, stored, served, executed. A 200 on the upload is only the first.
  2. Where did the file land, and who chose the name? If the scanner guessed the URL and got 404, the result is unknown, not clean.
  3. Did the fetch return output or source? Output that only execution can produce is execution. Source is data.
  4. What maps handlers on that server? For Apache, find the actual handler line: anchored <FilesMatch> or AddHandler. For nginx, find the PHP location and the FPM pool's security.limit_extensions.
  5. Can an upload change the mapping? Is .htaccess accepted, and is AllowOverride open on that directory?
  6. What headers does the file's URL send? Content-Type, Content-Disposition, nosniff, and the host. No Content-Type plus no nosniff let HTML run in the lab.
  7. Is SVG or HTML accepted? If so, load it in a browser and check which cookies the script can see.
  8. Can the filename move the write? ../ in the name, and any API that exposes the unstripped path.
  9. Did the fix get retested by fetching, not by reading config? The <Directory> fix in the opening scenario looked right and did nothing.
  10. For a clean result: did the scan upload through the real endpoint, with the field name and Content-Type the application expects, and then fetch? The crawler-coverage post covers endpoints a scan never reached, and the scan-passed post covers checks that ran without testing anything.

What this post did not measure

The hypothetical findings, resolved

Back to the four findings.

Unrestricted upload of shell.php, 200 {"ok": true}. Accepted, not proven stored or served. In the lab's version of this endpoint the file sat outside the web root behind a download script that sent attachment, and Chromium downloaded a test file served that way. Downgraded from code execution, and kept open as "accepts arbitrary files", with a note to check what else reads them.

Double-extension bypass, closed as a false positive. Right for A1, where shell.php.jpg came back as source. Wrong for A2, the same Apache build with an AddHandler line, where it executed. Reopened until someone reads that virtual host's handler line and fetches the file. If it is AddHandler, the finding is critical and the fix is a server-chosen name.

Stored XSS via SVG, closed because of nosniff. True positive: served as image/svg+xml with nosniff, it ran and read the session cookie. Reopened, with attachment, a separate registrable domain or refusing SVG as the fix.

The <Directory> fix. Not fixed: on A4, .php, .phtml, .phar and .jpg.php all still executed. Reopened. Of the placements that worked in the lab, two still served HTML with no Content-Type, so the reopened finding includes the headers, and the retest has to upload a file and fetch it.

Where AppSecD fits

AppSecD's dynamic and API testing runs Nuclei, Dalfox, SQLMap, Commix, Katana, Arjun, FFuf and Interactsh for out-of-band detection, plus 150+ native checks and API discovery across 50+ web frameworks. That line, and the shorter mentions of dynamic testing elsewhere in data/products.ts, are what the file says about it. None of them mentions file upload testing, so this post does not claim AppSecD tests for it. The measurements, the confirmation procedure, the fixes and the checklist above are general practice that applies to any scanner's output, ours included.

The scenario in this post is hypothetical and does not describe any deployment, user or finding.

More about AppSecD · All posts