Skip to content

Commit

Permalink
[PHP] Enable SSRF tests (#3769)
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana authored Jan 31, 2025
1 parent 3f6a518 commit c112a3c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
20 changes: 10 additions & 10 deletions manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,17 @@ tests/:
Test_Sqli_UrlQuery: missing_feature
Test_Sqli_Waf_Version: v1.6.2
test_ssrf.py:
Test_Ssrf_BodyJson: missing_feature
Test_Ssrf_BodyUrlEncoded: missing_feature
Test_Ssrf_BodyXml: missing_feature
Test_Ssrf_Capability: missing_feature
Test_Ssrf_Mandatory_SpanTags: missing_feature
Test_Ssrf_Optional_SpanTags: missing_feature
Test_Ssrf_Rules_Version: v1.6.2
Test_Ssrf_StackTrace: missing_feature
Test_Ssrf_BodyJson: v1.7.0
Test_Ssrf_BodyUrlEncoded: v1.7.0
Test_Ssrf_BodyXml: v1.7.0
Test_Ssrf_Capability: v1.7.0
Test_Ssrf_Mandatory_SpanTags: v1.7.0
Test_Ssrf_Optional_SpanTags: v1.7.0
Test_Ssrf_Rules_Version: v1.7.0
Test_Ssrf_StackTrace: v1.7.0
Test_Ssrf_Telemetry: missing_feature
Test_Ssrf_UrlQuery: missing_feature
Test_Ssrf_Waf_Version: v1.6.2
Test_Ssrf_UrlQuery: v1.7.0
Test_Ssrf_Waf_Version: v1.7.0
waf/:
test_addresses.py:
Test_BodyJson: v0.98.1 # TODO what is the earliest version?
Expand Down
24 changes: 23 additions & 1 deletion utils/build/docker/php/common/rasp/ssrf.php
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
<?php echo "Hello, SSRF!";
<?php

$domain = null;
$contentType = $_SERVER['CONTENT_TYPE'] ?? "";
switch ($contentType) {
case 'application/json':
$body = file_get_contents("php://input");
$decoded = json_decode($body, 1);
$domain = $decoded["domain"];
break;
case 'application/xml':
$body = file_get_contents("php://input");
$decoded = simplexml_load_string(stripslashes($body));
$domain = (string)$decoded[0];
break;
default:
$domain = urldecode($_REQUEST["domain"]);
break;
}

file_get_contents('http://'.$domain);

echo "Hello, SSRF!";

0 comments on commit c112a3c

Please sign in to comment.