File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff 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
1818class CoreTestEnv (HttpdTestEnv ):
Original file line number Diff line number Diff line change 1+ <!--#exec cmd="echo SSI_OK" -->
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments