Skip to content

Commit 819db13

Browse files
author
devenv
committed
Adds test for SSI query string injection
1 parent befb523 commit 819db13

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

test/modules/core/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CoreTestSetup(HttpdTestSetup):
1212
def __init__(self, env: 'HttpdTestEnv'):
1313
super().__init__(env=env)
1414
self.add_source_dir(os.path.dirname(inspect.getfile(CoreTestSetup)))
15-
self.add_modules(["cgid"])
15+
self.add_modules(["cgid","include"])
1616

1717

1818
class CoreTestEnv(HttpdTestEnv):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!--#exec cmd="echo SSI_OK" -->

test/modules/core/test_004_ssi.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import pytest
2+
import textwrap
3+
4+
from pyhttpd.conf import HttpdConf
5+
6+
class TestSSIInjection:
7+
8+
@pytest.fixture(autouse=True, scope="class")
9+
def _class_scope(self, env):
10+
conf = HttpdConf(env, extras={
11+
"base": textwrap.dedent(f"""
12+
<Directory "{env.gen_dir}">
13+
Options +Includes
14+
AddType text/html .shtml
15+
AddOutputFilter INCLUDES .shtml
16+
</Directory>
17+
""")
18+
})
19+
conf.install()
20+
assert env.apache_restart() == 0
21+
22+
def test_ssi_004_01(self, env):
23+
"""
24+
CVE-2025-58098:
25+
Server Side Includes must not add query string to #exec cmd=...
26+
"""
27+
url = env.mkurl("http", "htdocs", "/ssi/exec.shtml?INJECTED")
28+
r = env.curl_get(url)
29+
30+
body = r.response["body"].decode("utf-8")
31+
assert "SSI_OK" in body
32+
assert "INJECTED" not in body

0 commit comments

Comments
 (0)