Repository navigation
feat: expose protocol, CWE and WASC IDs in the DAST ground truth (SasanLabs/VulnerableApp#856) - #36
Conversation
The Unrestricted File Upload vulnerability types listed WASC 49 next to CWE 434. WASC 49 is "Insufficient Password Recovery" in the WASC Threat Classification, which has no class for unrestricted file uploads. That is why VulnerableApp maps UNRESTRICTED_FILE_UPLOAD to CWE 434 with no WASC ID. The DAST ground truth is about to publish these IDs as wascIds, so with the wrong mapping every FileUpload row would be matched by a scanner's password recovery finding. The type now carries only the CUSTOM name and CWE 434, the same mapping as in VulnerableApp. The definition and every level hint use this list, so /VulnerabilityDefinitions drops the WASC entry as well.
/scanner/dast rows only carried url, variant, method and the CUSTOM vulnerabilityTypes names. The DAST ground-truth schema agreed in SasanLabs/VulnerableApp#854, which the Java application already serves, also needs protocol, cweIds and wascIds on every row. Without them the facade's merged ground truth gives the benchmark comparator no way to match a PHP row by CWE or WASC, because the PHP type names are not VulnerableApp VulnerabilityType values. Each row is now built from one list of vulnerability types: the types of the level's hints, or the definition's types when no hint has a CUSTOM entry, which is the fallback the names already used. From that list: - vulnerabilityTypes keeps the CUSTOM names exactly as before. - cweIds and wascIds turn the stored string IDs into unique positive integers in ascending order. A value that is not a positive integer is left out instead of guessed, so an unmapped type adds nothing and a list can be empty. - protocol is "HTTP", since every level is an HTTP endpoint. The PHP validation workflow now checks the live endpoint: every row has protocol HTTP and sorted, unique, positive integer ID lists, and the NoSQL Injection, Insecure Credential Storage, Magic Hash and File Upload rows have the expected names and IDs. The README documents the endpoint, how its rows are built, and the POST/HTTP limitation. Closes SasanLabs/VulnerableApp#856
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Description
/VulnerableApp-php/scanner/dastrows now follow the DAST ground-truth schema agreed in SasanLabs/VulnerableApp#854, which the Java app has served since SasanLabs/VulnerableApp#955. Each row getsprotocol,cweIdsandwascIds. The existing fields are unchanged.{"url":"http://localhost:8080/VulnerableApp-php/NoSQLInjection/LEVEL_1","variant":"UNSECURE","method":"POST","protocol":"HTTP","vulnerabilityTypes":["MongoDB NoSQL Injection"],"cweIds":[943],"wascIds":[19]}CUSTOMentry, which is the fallback the names already used.vulnerabilityTypesis unchanged.[].protocolis"HTTP"on every row, because the app has no WebSocket levels.vulnerabilityTypescweIdswascIds[434][][704][2][943][19][256][13]These IDs let the comparator in SasanLabs/VulnerableApp#877 match PHP rows by CWE or WASC. Right now it can only match them by type name.
The PHP validation workflow has a new step that checks the live endpoint. It requires
protocolHTTPand sorted, unique, positive integer ID lists on every row, and the rows above must have exactly those names and IDs. The README has a new "Scanner endpoints" section that covers both endpoints, how a row is built, and the POST/HTTP limitation.WASC 49 on Unrestricted File Upload
The file upload types listed WASC 49, which is "Insufficient Password Recovery". VulnerableApp maps
UNRESTRICTED_FILE_UPLOADto CWE 434 with no WASC ID, because the WASC Threat Classification has no class for file uploads. If WASC 49 were published, a password recovery finding would match all 12 FileUpload rows. The first commit removes it, so those rows have"wascIds": [], and/VulnerabilityDefinitionsno longer lists it either. The facade UI does not read WASC entries.The other mappings are published unchanged. One difference from the Java app: Insecure Credential Storage uses WASC 13, while VulnerableApp's
PLAINTEXT_PASSWORD_STORAGEuses WASC 15. Both are approximations, so I left it as a separate decision.Related Issue
Closes SasanLabs/VulnerableApp#856
How Was This Tested?
I had no Docker daemon or native PHP available. Instead I ran the code on PHP 8.2, the Dockerfile's version, compiled to WebAssembly with
@php-wasm/cli. The harness invokes the/VulnerableApp-php/scanner/dastroute throughBootstrapand setsNoSQLInjectionSeeder::$seeded, so MongoDB is not needed.url,variant,methodandvulnerabilityTypesas onmain, and the new fields match the table above.0,-1,abc,"",CWE-79and1.5, which are all dropped;CUSTOMentry and when there are no hints;[];[99, 200, 1000].display_errors=1anderror_reporting=-1. This matters because the Apache image has no php.ini, so a notice would end up inside the JSON. It is also identical on PHP 8.3 and 8.4.php -lpasses on both changed files, and/VulnerabilityDefinitionsstill renders.bash -eagainst that output, and it passes. It fails onmain's output (no new fields), and on each of these variants: an unsorted list, string IDs, a duplicate ID, a missingprotocol, WASC 49 put back on FileUpload, a missing module, an ID of 0, an empty array, and a body that is not JSON.The PHP validation workflow on this PR runs the same step against the Docker stack.
Summary by CodeRabbit