CVE-2025-69662: SQL injection in geopandas to_postgis() via geometry column name
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| python-geopandas (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
| Jammy |
Fix Released
|
Undecided
|
Unassigned | ||
| Noble |
Fix Released
|
Undecided
|
Unassigned | ||
| Questing |
Fix Released
|
Undecided
|
Unassigned | ||
Bug Description
CVE: https:/
Upstream fix: https:/
The original upstream fix modified 3 files:
- the actual py file, the fix was applied on a version `geopandas/
- the test, `geopandas/
- the changelog md file.
- Only `geopandas/
Tested with multipass on aarch64 mac
```
multipass launch 24.04 --name test2 --disk 25G
multipass shell test2
sudo apt-get update && sudo apt-get upgrade -y && \
sudo apt-get install python3-geopandas python3-sqlalchemy postgresql postgresql-client python3-geoalchemy2 postgresql-postgis -y && \
sudo reboot
multipass shell test2
sudo -u postgres psql -c "CREATE USER ubuntu WITH PASSWORD 'insecure' SUPERUSER;"
sudo -u postgres psql -c "DROP DATABASE IF EXISTS db1;" && \
sudo -u postgres psql -c "CREATE DATABASE db1 OWNER ubuntu;" && \
sudo -u postgres psql -d db1 -c "CREATE EXTENSION postgis;"
cat << 'EOF' > ~/script1.py
import geopandas as gpd
from shapely.geometry import Point
from sqlalchemy import create_engine
import re
engine = create_
# Step 1: Create table with geometry column named 'geom'
gdf_normal = gpd.GeoDataFram
gdf_normal = gdf_normal.
gdf_normal.
print("✅ Table created with 'geom' column")
# Step 2: Exploit - Find_SRID(
gdf_exploit = gpd.GeoDataFram
gdf_exploit = gdf_exploit.
try:
gdf_
except Exception as e:
match = re.search(r'invalid input syntax for (?:type )?integer: "([^"]+)"', str(e))
if match:
print(f"✅ EXTRACTED PostgreSQL version: {match.group(1)}")
else:
print(f"Raw error: {e}")
EOF
```
Before patched
```
ubuntu@test2:~$ python3 script1.py
✅ Table created with 'geom' column
✅ EXTRACTED PostgreSQL version: PostgreSQL 16.11 (Ubuntu 16.11-0ubuntu0.
ubuntu@test2:~$
```
After patched:
```
ubuntu@cve:~$ python3 script1.py
✅ Table created with 'geom' column
Raw error: (psycopg2.
CONTEXT: PL/pgSQL function find_srid(character varying,character varying,character varying) line 17 at RAISE
[SQL: SELECT Find_SRID(
[parameters: {'schema_name': 'public', 'name': 'test_table', 'geom_name': "geom') UNION SELECT CAST(version() AS int); --"}]
(Background on this error at: https:/
ubuntu@cve:~$
```
CVE References
| Changed in python-geopandas (Ubuntu): | |
| assignee: | nobody → Eduardo Barretto (ebarretto) |
| status: | New → In Progress |

Thanks Titi and sorry for the delay to get to it.
I've had to do some small adjustments to your debdiff, but nevertheless it was good and we thank you for your help!
I've just uploaded it to our security-proposed ppa, if you could run some test and check it is all good, we would appreciate! /launchpad. net/~ubuntu- security- proposed/ +archive/ ubuntu/ ppa/+packages? field.name_ filter= python- geopandas& field.status_ filter= published& field.series_ filter=
https:/