CVE-2025-69662

8.6 HIGH

📋 TL;DR

CVE-2025-69662 is an SQL injection vulnerability in geopandas' to_postgis() function that allows attackers to execute arbitrary SQL commands when writing GeoDataFrames to PostgreSQL databases. This can lead to data theft, modification, or database compromise. Users of geopandas applications that export geographic data to PostgreSQL are affected.

💻 Affected Systems

Products:
  • geopandas
Versions: All versions before 1.1.2
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using the to_postgis() function with user-controlled or untrusted input parameters.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise including data exfiltration, data destruction, privilege escalation to database server, and potential lateral movement to connected systems.

🟠

Likely Case

Data theft of sensitive geographic information, modification of spatial data integrity, and potential exposure of database credentials.

🟢

If Mitigated

Limited impact with proper input validation, parameterized queries, and database user privilege restrictions in place.

🌐 Internet-Facing: HIGH if vulnerable application accepts user input for to_postgis() parameters and is internet-accessible.
🏢 Internal Only: MEDIUM for internal applications that process untrusted data sources or user inputs.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires user input to reach the vulnerable to_postgis() function parameters. Public proof-of-concept demonstrates injection via schema and table name parameters.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.1.2

Vendor Advisory: https://github.com/geopandas/geopandas/pull/3681

Restart Required: No

Instructions:

1. Update geopandas: pip install --upgrade geopandas>=1.1.2
2. Verify installation: python -c "import geopandas; print(geopandas.__version__)"
3. Test to_postgis() functionality with your application.

🔧 Temporary Workarounds

Input validation and sanitization

all

Validate and sanitize all user inputs passed to to_postgis() parameters before function execution.

Use parameterized queries manually

all

Bypass vulnerable to_postgis() by implementing custom parameterized SQL queries for PostgreSQL writes.

🧯 If You Can't Patch

  • Implement strict input validation for all parameters passed to to_postgis() function
  • Restrict database user permissions to minimum required privileges (read-only if possible)

🔍 How to Verify

Check if Vulnerable:

Check if application uses geopandas.to_postgis() with any user-controlled parameters like table names or schema names.

Check Version:

python -c "import geopandas; print(geopandas.__version__)"

Verify Fix Applied:

Verify geopandas version is 1.1.2 or higher and test to_postgis() with attempted SQL injection payloads.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL queries from application to PostgreSQL
  • Multiple failed login attempts to database
  • Unexpected schema or table creation/modification

Network Indicators:

  • SQL injection patterns in application-to-database traffic
  • Unusual database query volume from application server

SIEM Query:

source="postgresql" AND (query="DROP" OR query="UNION" OR query="SELECT * FROM") AND src_ip="[application_server]"

🔗 References

📤 Share & Export