CVE-2024-41118
📋 TL;DR
This vulnerability in streamlit-geospatial allows blind server-side request forgery (SSRF) where user-controlled URLs are passed to a Web Map Service function without proper validation. Attackers can make the application send HTTP requests to arbitrary internal or external destinations, potentially accessing sensitive systems. Users running streamlit-geospatial versions before the fix are affected.
💻 Affected Systems
- streamlit-geospatial
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Attackers could use the SSRF to access internal services, exfiltrate sensitive data from internal networks, or perform port scanning of internal infrastructure.
Likely Case
Attackers probe internal services, potentially accessing metadata services or other unprotected internal endpoints to gather information about the environment.
If Mitigated
With proper input validation and network segmentation, impact is limited to failed external requests or access to non-sensitive endpoints.
🎯 Exploit Status
Exploitation requires access to the Web Map Service page but no authentication. The SSRF is blind, meaning attackers don't see response content directly.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Commit c4f81d9616d40c60584e36abb15300853a66e489
Vendor Advisory: https://securitylab.github.com/advisories/GHSL-2024-100_GHSL-2024-108_streamlit-geospatial/
Restart Required: Yes
Instructions:
1. Update to the latest version of streamlit-geospatial that includes commit c4f81d9616d40c60584e36abb15300853a66e489. 2. Restart the streamlit application. 3. Verify the fix by checking that URL validation is now implemented.
🔧 Temporary Workarounds
Input Validation Filter
allImplement URL validation to restrict allowed domains or patterns before passing to get_wms_layer function.
# Add validation in pages/7_📦_Web_Map_Service.py before line 47
# Example: if not url.startswith('https://allowed-domain.com/'): raise ValueError('Invalid URL')
Network Restriction
linuxUse firewall rules to restrict outbound connections from the streamlit application server.
# Example iptables rule to restrict outbound HTTP/HTTPS
iptables -A OUTPUT -p tcp --dport 80 -j DROP
iptables -A OUTPUT -p tcp --dport 443 -j DROP
🧯 If You Can't Patch
- Disable or remove the Web Map Service page (pages/7_📦_Web_Map_Service.py) from the application.
- Implement a web application firewall (WAF) with SSRF protection rules to block malicious URL patterns.
🔍 How to Verify
Check if Vulnerable:
Check if your streamlit-geospatial version includes commit c4f81d9616d40c60584e36abb15300853a66e489. Review pages/7_📦_Web_Map_Service.py line 47 to see if URL validation is implemented.
Check Version:
git log --oneline | grep c4f81d9616d40c60584e36abb15300853a66e489
Verify Fix Applied:
Test the Web Map Service page with malicious URLs (like http://169.254.169.254/) and verify they are rejected or properly validated.
📡 Detection & Monitoring
Log Indicators:
- Unusual outbound HTTP requests from the streamlit application to internal IP addresses or unexpected domains
- Failed URL validation attempts in application logs
Network Indicators:
- HTTP requests from the streamlit server to internal metadata services (169.254.169.254, 192.168.0.0/16 ranges)
- Unexpected outbound traffic patterns from the application server
SIEM Query:
source="streamlit-app" AND (dest_ip=169.254.169.254 OR dest_ip IN [192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12])
🔗 References
- https://github.com/opengeos/streamlit-geospatial/blob/4b89495f3bdd481998aadf1fc74b10de0f71c237/pages/7_%F0%9F%93%A6_Web_Map_Service.py#L25
- https://github.com/opengeos/streamlit-geospatial/blob/4b89495f3bdd481998aadf1fc74b10de0f71c237/pages/7_%F0%9F%93%A6_Web_Map_Service.py#L47
- https://github.com/opengeos/streamlit-geospatial/blob/4b89495f3bdd481998aadf1fc74b10de0f71c237/pages/7_%F0%9F%93%A6_Web_Map_Service.py#L53
- https://github.com/opengeos/streamlit-geospatial/commit/c4f81d9616d40c60584e36abb15300853a66e489
- https://securitylab.github.com/advisories/GHSL-2024-100_GHSL-2024-108_streamlit-geospatial/
- https://github.com/opengeos/streamlit-geospatial/blob/4b89495f3bdd481998aadf1fc74b10de0f71c237/pages/7_%F0%9F%93%A6_Web_Map_Service.py#L25
- https://github.com/opengeos/streamlit-geospatial/blob/4b89495f3bdd481998aadf1fc74b10de0f71c237/pages/7_%F0%9F%93%A6_Web_Map_Service.py#L47
- https://github.com/opengeos/streamlit-geospatial/blob/4b89495f3bdd481998aadf1fc74b10de0f71c237/pages/7_%F0%9F%93%A6_Web_Map_Service.py#L53
- https://github.com/opengeos/streamlit-geospatial/commit/c4f81d9616d40c60584e36abb15300853a66e489
- https://securitylab.github.com/advisories/GHSL-2024-100_GHSL-2024-108_streamlit-geospatial/