Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP] Enable SSRF tests #3769

Merged
merged 3 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions utils/build/docker/php/common/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extension=mysqli.so
extension=pdo.so
extension=pdo_mysql.so
extension=pdo_pgsql.so
extension=simplexml.so
error_log=/var/log/system-tests/php_error.log
error_reporting=2147483647
display_errors=0
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!";
Loading