{"id":"CVE-2026-40258","kind":"vulnerability","aliases":["CVE-2026-40258","GHSA-m5gr-86j6-99jp"],"related":[],"title":"gramps-webapi: Zip Slip Path Traversal in Media Archive Import","description":"## Summary\n\nA path traversal vulnerability (Zip Slip) exists in the media archive import feature. An authenticated user with owner-level privileges can craft a malicious ZIP file with directory-traversal filenames to write arbitrary files outside the intended temporary extraction directory on the server's local filesystem.\n\n## Details\n\nWhen importing media archives as ZIP file, `MediaImporter._check_disk_space_and_extract()` in `gramps_webapi/api/media_importer.py` called `zipfile.extractall()` without validating ZIP entry names. Python's `zipfile` module does not sanitize entry names containing `../` sequences, allowing extraction to paths outside the target directory.\n\nOnly users with **owner permission** can upload media ZIP archives, so the biggest risk is for multi-tree deployments, where tree owners are distinct from server administrators.\n\nFor multi-tree deployments, the impact depends on deployment configuration. Assuming the standard docker-based deployment is used:\n\n- **SQLite family tree + local media**: An attacker can overwrite another tree's database file or media files, leading to cross-tree data corruption or replacement.\n- **Postgres family tree + S3 media**: No persistent tree data is stored on the local filesystem,  so cross-tree impact is eliminated. The remaining risk is overwriting volume-mounted files such as the application config file.\n- **Postgres family tree + S3 media + environment-variable-only config**: No persistent files of  value are present on the local filesystem. Impact is limited to writes to ephemeral container storage, which are lost on woker restart.\n\n## Fix\n\nZIP entry names are now validated against the resolved real path of the temporary directory before extraction. Any entry whose resolved path falls outside the temporary directory raises an error and aborts the import.","summary":"Gramps Web API extracts uploaded media ZIP archives without checking entry names, so a ZIP with ../ paths writes files outside the extraction directory. An owner-level user can overwrite other trees' database or media files on local-storage deployments.","severity":"critical","cvss":9.1,"epss":0.00401,"exploited":false,"exploited_at":null,"products":[{"name":"gramps-webapi","fixed":["3.11.1"],"affected":">= 1.6.0, <= 3.11.0","ecosystem":"pypi"}],"ecosystems":["pypi"],"tags":["cwe-22","gramps-web","multi-tree","package","python","self-hosted"],"not_affected_if":["env-only-config","postgres-with-s3-media","single-tree"],"how_to_check":"- Run `pip show gramps-webapi` and confirm the installed version is between `1.6.0` and `3.11.0`\n- Check whether multiple family trees are hosted on one instance with SQLite trees and local media storage","fix":"- Upgrade `gramps-webapi` to `3.11.1`\n- Until upgraded, restrict media ZIP import to trusted users or disable owner uploads on shared instances","status":"open","published_at":"2026-04-10T21:00:09+00:00","first_seen_at":"2026-10-27T16:35:55+00:00","triaged_at":"2026-10-27T16:38:03+00:00","updated_at":"2026-10-27T16:38:03+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-10-27T16:38:03Z","model":"claude-haiku-5-5","output":{"fix":"- Upgrade `gramps-webapi` to `3.11.1`\n- Until upgraded, restrict media ZIP import to trusted users or disable owner uploads on shared instances","reach":"internet","title":"gramps-webapi: media ZIP import lets owners write files outside temp directory","impact":"high","summary":"Gramps Web API extracts uploaded media ZIP archives without checking entry names, so a ZIP with ../ paths writes files outside the extraction directory. An owner-level user can overwrite other trees' database or media files on local-storage deployments.","category":"package","nicknames":[],"who_cares":["self-hosted","python","gramps-web","multi-tree"],"confidence":0.8,"needs_auth":"yes","worst_case":"Attacker overwrites other trees' database or media files on the server","analyst_note":"","how_to_check":"- Run `pip show gramps-webapi` and confirm the installed version is between `1.6.0` and `3.11.0`\n- Check whether multiple family trees are hosted on one instance with SQLite trees and local media storage","needs_analyst":false,"not_affected_if":["single-tree","postgres-with-s3-media","env-only-config"],"who_is_affected":"Deployments running gramps-webapi between 1.6.0 and 3.11.0 that let tree owners upload media archives. The risk is highest on multi-tree servers where owners differ from administrators and trees use SQLite or local media files. Single-tree deployments, or Postgres with S3 media and environment-only config, have much less exposed data.","user_interaction":"no","needs_special_setup":"no","severity_if_unknown":"critical"},"cost_usd":0.000669,"input_tokens":3865,"output_tokens":566,"severity_before":"critical"},"analyst_status":null,"analyst_note":null,"search":"'-2026':13A,21A '-22':27B '-40258':14A,22A '86j6':18A '99jp':19A 'abort':346C 'administr':194C 'allow':159C 'anoth':224C 'api':41B 'applic':275C 'arbitrari':115C 'archiv':10A,46B,91C,133C,176C 'assum':206C 'attack':221C 'authent':95C 'base':211C 'biggest':179C 'call':141C 'check':48B 'config':276C,287C 'configur':205C 'contain':157C,306C 'corrupt':238C 'craft':103C 'cross':235C,258C 'cross-tre':234C,257C 'cve':12A,20A 'cwe':26B 'data':237C,249C 'databas':71B,227C 'depend':202C 'deploy':79B,186C,199C,204C,212C 'detail':129C 'directori':61B,110C,122C,166C,329C,341C 'directory-travers':109C 'distinct':191C 'docker':210C 'docker-bas':209C 'elimin':262C 'entri':49B,146C,155C,316C,333C 'environ':284C 'environment-variable-on':283C 'ephemer':305C 'error':344C 'exist':87C 'extract':42B,60B,121C,160C,331C 'fall':337C 'famili':216C,242C,279C 'featur':93C 'file':57B,74B,107C,116C,136C,228C,231C,271C,277C,290C 'filenam':112C 'filesystem':128C,255C,298C 'fix':314C 'ghsa':16A 'ghsa-m5gr-86j6-99jp':15A 'gramp':2A,29B,39B,139C 'gramps':24A 'gramps-web':28B 'gramps-webapi':1A,23A 'host':38B 'impact':201C,260C,299C 'import':11A,92C,131C,348C 'intend':119C 'lead':232C 'level':65B,100C 'limit':301C 'local':77B,127C,218C,254C,297C 'local-storag':76B 'lost':310C 'm5gr':17A 'malici':105C 'media':9A,44B,73B,90C,132C,174C,219C,230C,245C,282C 'mediaimporter._check_disk_space_and_extract':137C 'modul':151C 'mount':270C 'multi':32B,184C,197C 'multi-tre':31B,183C,196C 'name':50B,147C,156C,317C 'outsid':58B,117C,163C,338C 'overwrit':68B,223C,267C 'owner':64B,99C,170C,189C 'owner-level':63B,98C 'packag':34B 'path':6A,55B,82C,162C,325C,336C 'permiss':171C 'persist':247C,289C 'postgr':241C,278C 'present':294C 'privileg':101C 'python':35B,148C 'rais':342C 'real':324C 'remain':264C 'replac':240C 'resolv':323C,335C 'restart':313C 'risk':180C,265C 's3':244C,281C 'sanit':154C 'self':37B 'self-host':36B 'sequenc':158C 'server':125C,193C 'slip':5A,86C 'sqlite':215C 'standard':208C 'storag':78B,307C 'store':251C 'summari':80C 'target':165C 'temporari':120C,328C,340C 'travers':7A,83C,111C 'tree':33B,70B,185C,188C,198C,217C,225C,236C,243C,248C,259C,280C 'upload':43B,173C 'use':214C 'user':66B,96C,168C 'valid':144C,320C 'valu':292C 'variabl':285C 'volum':269C 'volume-mount':268C 'vulner':84C 'web':30B,40B 'webapi':3A,25A 'webapi/api/media_importer.py':140C 'whose':334C 'without':47B,143C 'woker':312C 'write':56B,114C,303C 'zip':4A,45B,53B,85C,106C,135C,145C,175C,315C 'zipfil':150C 'zipfile.extractall':142C","nicknames":[],"mitigations":[],"who_affected":"Deployments running gramps-webapi between 1.6.0 and 3.11.0 that let tree owners upload media archives. The risk is highest on multi-tree servers where owners differ from administrators and trees use SQLite or local media files. Single-tree deployments, or Postgres with S3 media and environment-only config, have much less exposed data.","tier":"B","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-04-10T21:00:09+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-m5gr-86j6-99jp","url":"https://github.com/advisories/GHSA-m5gr-86j6-99jp","severity":"critical","published_at":"2026-04-10T21:00:09+00:00","modified_at":"2026-10-27T16:31:57+00:00","first_seen_at":"2026-10-27T16:35:55+00:00","fetched_at":"2026-10-27T16:35:55+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-40258","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40258","severity":null,"published_at":"2026-04-17T22:16:32+00:00","modified_at":"2026-10-26T21:10:00+00:00","first_seen_at":"2026-10-27T17:03:04+00:00","fetched_at":"2026-10-27T17:03:04+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}