Qualifying the security posture of spatial libraries? (GDAL, GEOS, PROJ)

One of the hot spots for CVEs in Django these days is our interface with the spatial libraries required by GeoDjango (GDAL, GEOS, and PROJ). Do we need to update the Django docs to be honest about how “gray” the security posture is?

While we are grateful for the security support these libraries offer, that support is more limited than what we get from Python: perhaps only a fix in the next patch or feature release. Public web services may not even be a primary use case for these analysis libraries.

For example, the GDAL Security Considerations document offers advice to:

  • always run the latest version
  • restrict filesystem access with a sandbox
  • rebuild from source with a compile-time option to disable curl
  • limit allowed drivers at compile- or runtime, since the chaining of drivers yields a “not obvious” attack surface

This is miles away from the recipe in Django’s docs to sudo apt-get install binutils libproj-dev gdal-bin.


Members of the Django Security Team are actively engaging with the maintainers on some follow-ups, as they prefer to analyze security reports in the open. One told me that GeoJSON clients are simply not prepared for malicious inputs:

Most current file formats and their parsers have been written in good faith. They are not prepared for counterfeit data.


Given that, Django’s Security Team often has to decide how much effort to expend re-implementing a safer parser in Django before forwarding inputs to spatial libraries.

When the attack surface is wide, we’ve bitten the bullet and re-implemented. One particularly tricky case for GEOS took a second try to get right.

For one issue fixed in today’s Django releases, we had:

  • a narrow attack surface
  • reimplementing the parsing would have been error prone / impossible to avoid breaking valid cases
  • a “safer” method was available in GDAL 3.9+

…so we just used the safer method if the GDAL version was 3.9 or better, and issued a system check warning (that could be silenced if you weren’t using the niche functionality) if you were using GeoDjango on anything lower.


Django generally “officially” supports the last five years of spatial library releases. This is a practice, not documented, I don’t think. However, in these times drenched with AI findings, this is in tension with “Django is secure by default” if the official upstream advice is “Upgrade to the latest versions … that might contain fixes for some vulnerabilities.”

Is the system check framework the right place to be collecting this knowledge about where Django does not provide total protection against malicious inputs? (Developers ignore warnings.) And/or, should it be collected in Django’s docs, by adding a “Secure version” column to the versions table, with footnotes about Django’s various levels of protections?


Will “five years” really hold up in the AI-vuln era? GDAL 3.9 will be approximately 3 years old when Django 6.2 is released in April. It’s tempting to make that the minimum version and drop today’s system check (or elevate it to an error) so that the 6.2 LTS has the best security posture. But GDAL is not the easiest to install.
(For reference, on Django’s 6.1 branch, we had to alter the postgis.yml workflow to add an unstable apt repository to get GDAL 3.9 and pass our own test cases, even though it’s over two years old.)

GeoDjango users, what would be most helpful here, in terms of policy and docs?

4 Likes

I would be against generalizing such a policy. In this specific GDAL case, it might make sense (considering 3.9+ is already in most stable Linux distros). But for most security issues, people using stable distributions which ensure latest security patches are backported (like Debian, for my case), are safe.

We could formulate some recommendation like: if you installed these packages yourself instead of relying on a security-supported system or distribution, ensure to always use the latest supported version.

Debian has never applied any patches for GEOS. The last Debian security advisory for GDAL was in 2022.

Debian hasn’t even applied Django’s fix for CVE-2026-15830 (the “took two tries” parser I mentioned for nested GeoJSON geometries):

[bookworm] - python-django (Invasive fix; too difficult to backport; affects only GeoSpatial component)
[bullseye] - python-django (Invasive fix; too difficult to backport; affects only GeoSpatial component)

My point is that GEOS and GDAL have a different standard for what is a security issue / CVE, since public web services are not a primary use case for them. They won’t issue CVEs for every segfault. But when you can consistently segfault a worker process, that’s a problem for Django.

Ouch! Looks like I’m too confident towards distributions. Point taken.

Nevertheless, use cases are diverse, public websites accepted untrusted inputs have different requirements than internal read-only map displays. Secure by default is (very) good, until you require people compiling packages manually (and those might be reluctant to upgrade due to extra work). Balance, balance :grin:

3 Likes

Balance, balance

I agree with this.

I am torn between providing a good period of spatial libraries support and our ability to backport security patches from a C library to Python. To dive into Jacob’s example above, in Refs CVE-2026-15830 -- Fixed WKB geometry collection limit bypasses. · django/django@62ef9d4 · GitHub the result is reading bytes, getting big and little-endian correct and so on. I am very pleased that this change landed, but it’s a challenge to get right. I am unsure we can keep supporting these - especially when we get cases that are even harder to solve.

One option could be to recommend Conda/conda-forge as the primary install source.

This would give users the ability to pin the dependencies like with Python and it has the latest versions available, usually within ~24hours of release. There’s a wide variety of compatible versions (e.g. PostGIS/Spatialite/GEOS/GDAL/Proj combinations) available, so hopefully there is something for everyone.

This could become our expected standard for any security vulnerabilities. That is, you must be using up-to-date dependencies.

We can also appreciate that use cases may vary. Using older versions may therefore be totally fine in some scenarios. We can recommend using the latest version, similar to, but not quite as strong as the Python version recommendation. If folk want to run on older versions, we won’t stop them. The docs can be give a suitable health warning. This can be generic as I’m less sure about giving a detailed account of all the reports we’ve had and why you should upgrade.

1 Like

I have just seen that Django has issued an advisory-only CVE before: CVE-2011-4140.

I did not know this was an option :thinking:

Maybe we should take this approach when a fix within Django is not feasible to protect folks using older versions of a library. We issue an advisory stating that users of the affected functionality need to upgrade that library or implement their own protections.

We could still have a “Recommended minimum version” column and update the recommendations in patch releases, with footnotes linking to the relevant advisories (possibly in a “GeoDjango security considerations” page).

1 Like

I like what Sarah suggested.

For me (and probably for some other people working on many Django instances), having to follow/update geo-libs dependencies separately is not an option. Even if you showed earlier in this thread that it’s not completely failproof, I trust my OS security for such packages. I simply do not have the bandwidth for that.

(Officially replying to @claudep, but also the points leading up to that)

Not focusing on the details right now, there’s seems a parallel to the thread on sqlparse. It seems reasonable to scope the security policy coverage to supported use-cases.

Exactly. So, just to comment, that if the conclusion is along those lines, then +1 to a documentation based approach. (Certainly over us trying to retrofit adversarial scenario level security onto libraries that don’t recognise that as a legitimate target.)