本 Lab 使用 GeoServer/PostGIS 在本地环境中研究 OGC Filter SQL 注入,明确区分 operator/setup 模式和 attacker 模式。
GeoServer 2.22.0 嵌入了存在漏洞的 GeoTools。GeoServer 2.22.2 嵌入了已修补的 GeoTools。Lab 保持相同的 schema/request,以便对版本、缓解措施和权限边界进行 A/B 测试。
| 模式 | 攻击面 | 目的 |
|---|
| Setup/operator REST | cve-operator 内部容器 | REST 设置、验证和后端日志审查 |
| 单一网关 | 127.0.0.1:8889 | operator UI 和 OWS 路由共用一个端口 |
| Operator Web UI | 127.0.0.1:8889/geoserver/web/ | 供运维人员使用的 GeoServer UI;带 Basic Auth 代理 |
| Attacker vulnerable | 127.0.0.1:8889/vuln/geoserver/ows | 存在漏洞的 WFS/OWS,DB 错误显示在响应中 |
| Attacker patched | 127.0.0.1:8889/patched/geoserver/ows | GeoServer 2.22.2 / GeoTools 28.2 |
| Attacker realistic | 127.0.0.1:8889/realistic/geoserver/ows | 存在漏洞的 WFS/OWS,但网关会剥离错误详情 |
| Mitigation function | 127.0.0.1:8889/mit-functions/geoserver/ows | GeoServer 2.22.0,encode functions=false |
| Mitigation FeatureId | 127.0.0.1:8889/mit-featureid/geoserver/ows | GeoServer 2.22.0,preparedStatements=true |
PostgreSQL/PostGIS 不向主机发布端口。GeoServer 不直接向主机发布 8080 端口;主机只能通过 127.0.0.1:8889 看到 cve-gateway。容器 cve-attacker 仅位于 attacker-net;它没有通往 PostgreSQL 或 GeoServer 内部服务的路由。REST 设置通过 geoserver-net 上的内部容器 cve-operator 进行。
在浏览器中打开:
http://127.0.0.1:8889/geoserver/web/
两层登录:
operator / operator_labadmin / geoserver所有内容都通过同一个网关 8889,无需记住多个端口。Burp 可以保留默认代理 127.0.0.1:8080。
.\lab.ps1 reset all
.\lab.ps1 validate
powershell -ExecutionPolicy Bypass -File .\verify-lab.ps1
powershell -ExecutionPolicy Bypass -File .\negative-controls.ps1
powershell -ExecutionPolicy Bypass -File .\attack-chain.ps1
管理命令:
.\lab.ps1 start vulnerable
.\lab.ps1 start patched
.\lab.ps1 start mitigated
.\lab.ps1 start worstcase
.\lab.ps1 reset all
.\lab.ps1 stop
.\lab.ps1 status
种子表:
cities:integer 主键,name 文本列,用于 strStartsWith/strEndsWith。sensors_text:text 主键,用于 FeatureId 注入。sensors_int:integer 主键,用于 FeatureId 的阴性对照。events:JSONB 研究层。internal_assets:不发布,每次 reset 后包含新的 LAB-CANARY-<UUID>。local_points:非 JDBC shapefile 阴性对照。角色:
geoserver_readonly:CONNECT、USAGE schema,仅对已发布表 SELECT。geoserver_impact:额外对 internal_assets SELECT,以演示应用 DB 用户权限过宽。geoserver_worstcase:独立 profile,具有 pg_read_server_files 以读取伪造的 canary 文件 /lab/flag.txt。attack-chain.ps1 执行:
GetCapabilities。DescribeFeatureType。encode functions=false 确认 CVE-2023-25157。preparedStatements=true 确认 CVE-2023-25158。internal_assets,impact 分支泄露 canary,patched/realistic 不披露 canary。证据保存到 evidence/attack-chain-*。当前文件夹仅保留最新的通过证据以避免混乱。
此 profile 不属于主要场景:
.\lab.ps1 start worstcase
powershell -ExecutionPolicy Bypass -File .\worstcase-demo.ps1
它仅读取伪造的 canary 文件 /lab/flag.txt,不读取 /etc/passwd,不 dump hash,不破解密码。