PyTables runs code hidden in an HDF5 file when an application reads one metadata attribute. The library sits underneath pandas.read_hdf(), and the PyTables vulnerability CVE-2026-134019 scores 9.8 on CVSS 3.1. No fixed release exists on PyPI as of November 25, 2026.
A single trailing byte triggers the bug. PyTables treats any byte-string attribute that ends in a period as a pickled Python object and hands it to pickle.loads(). Pickle is Python's native serialization format, and loading a pickle can call arbitrary functions. No allowlist of classes stands in the way.
The attacker needs no account and no privileges on the target. One condition applies. A victim application must open an attacker-supplied .h5 file and read an attribute from it. The PyTables security advisory GHSA-3r7g-mq96-7hhc credits the report to a GitHub user named YuuLuo.
No fixed release yet
No patched PyTables release exists as of November 25, 2026. Version 3.11.1, the latest on PyPI, has no switch for automatic unpickling. Do not open HDF5 files from outside sources with it.
PyTables, pandas and 2.6 million monthly downloads
PyTables ships on PyPI under the package name tables. Its CVE record describes it as "a Python package to manage extremely large amounts of data". The current release, 3.11.1, requires Python 3.11 or newer.
PyPI Stats counted 2,595,178 downloads of tables in the month before November 25, 2026. The same counter showed 637,026 downloads for the week and 71,592 for the last day. On GitHub the PyTables repository holds 1,377 stars and 293 forks.
Pandas multiplies the reach. The advisory says pandas.read_hdf() "builds on PyTables and reads node attributes, widening reach". The pandas repository has 50,627 stars.
The pandas source on main shows the plumbing. In pandas/io/pytables.py, read_hdf builds an HDFStore on line 495. HDFStore.open then calls tables.open_file(self._path, self._mode, **kwargs) on line 850.
Pandas reads the node attributes pandas_type and table_type through getattr(group._v_attrs, ...). Lines 2287 and 2288 are one example. Those lookups go through AttributeSet, the class at the heart of the bug. That link is our reading of the code, because the advisory names no specific pandas attributes.
HDF5 is widely perceived as a safe, code-free data format (like
— PyTables security advisory GHSA-3r7g-mq96-7hhc.npy/ Parquet), so consumers do not expect that reading metadata runs code.
The vulnerable function: AttributeSet.__getattr__
HDF5 attributes carry the metadata attached to each node of a file. PyTables stores non-primitive Python objects as pickled attributes, the advisory says. On the way back it has to guess which stored values are pickles. The guess lives in AttributeSet.__getattr__, which starts on line 309 of tables/attributeset.py.
format_version = self._v__format_version
value = self._g_getattr(self._v_node, name)
# Check whether the value is pickled
# Pickled values always seems to end with a "."
maybe_pickled = (
isinstance(value, np.generic) # NumPy scalar?
and value.dtype.type == np.bytes_ # string type?
and value.itemsize > 0
and value.endswith(b".")
)
tables/attributeset.py, lines 322 to 332, commit 6508c4d (main before the fix). Source.
Line 323 reads the raw attribute bytes from the file with _g_getattr. Four conditions then set maybe_pickled. The value must be a NumPy scalar, its type must be np.bytes_, its size must be above zero, and it must end with b".". The comment on line 326 states the whole rationale in one line.
That rationale holds in one direction only. Python's pickle module defines its STOP opcode as b'.', so a pickle stream ends with a period. (We confirmed that for protocols 0 through 5 on a local interpreter.) PyTables inverts the rule and assumes every byte string ending in a period is a pickle.
The check reads the type, the size and the last byte. An attacker controls all three, because all three come from the file.
The module imports the standard pickle on line 6 with no restrictions. What happens to a flagged value depends on a chain of branches.
if maybe_pickled and value in [b"0", b"0."]:
# Workaround for a bug in many versions of Python (starting
# somewhere after Python 2.6.1). See ticket #253.
retval = value
elif (
maybe_pickled
and _field_fill_re.match(name)
and format_version == (1, 5)
):
# This format was used during the first 1.2 releases, just
# for string defaults.
try:
retval = pickle.loads(value)
retval = np.array(retval)
except ImportError:
retval = None # signal error avoiding exception
elif (
maybe_pickled
and name == "FILTERS"
and format_version is not None
and format_version < (2, 0)
):
# This is a big hack, but we don't have other way to recognize
# pickled filters of PyTables 1.x files.
value = _old_filters_re.sub(_new_filters_sub, value, 1)
retval = pickle.loads(value) # pass unpickling errors through
elif maybe_pickled:
try:
retval = pickle.loads(value)
tables/attributeset.py, lines 334 to 362, commit 6508c4d. Source.
Only two literal values escape, b"0" and b"0.", on lines 334 to 337. Every other flagged value reaches pickle.loads(value) through one of three branches.
Line 346 handles field defaults from files in format version 1.5, matched by _field_fill_re. Line 359 handles the FILTERS attribute of files older than format 2.0 and lets unpickling errors propagate. Line 362 is the general branch and the one the published proof of concept hits.
A failed load gets two more attempts. On UnicodeDecodeError (line 368) the function calls pickle.loads(value, encoding="latin1") on line 375. If that raises TypeError, it tries encoding="bytes" on line 378. Any other exception is swallowed on line 383 and the raw bytes come back.
A code comment dated 2005-09-07 says telling a broken pickle from a plain string was "too hard". The code shows the consequence. A harmless string that only looks like a pickle fails quietly, and a real payload gets no warning either.
The application does not even have to name the hostile attribute. Reading the code, AttributeSet.__init__ loops over every attribute of the node on lines 255 to 258 and calls self.__getattr__(attr) for each. Line 424 then caches the result in self.__dict__.
Building the attribute set for a node therefore unpickles all of its attributes at once. The advisory does not describe that behavior. The merged code keeps the loop on line 262.
Dictionary-style access offers no shelter. AttributeSet.__getitem__ on line 596 forwards straight to __getattr__, so attrs["name"] triggers the same load. The advisory gives approximate line numbers (around 308 and 592), while ours come from commit 6508c4d.
From open_file to os.system in one attribute read
The exploitation chain has five links. The victim process calls tables.open_file(path, "r") on the attacker's file. It then reads an attribute, either as node._v_attrs.name or as node._v_attrs["name"].
Inside PyTables, __getattr__ fetches the stored bytes on line 323. The trailing period sets maybe_pickled on lines 327 to 332. Line 362 calls pickle.loads(value), and the pickle's own instructions pick the function to run.
YuuLuo published a two-script proof of concept in the advisory, verified on tables==3.11.1 with Python 3.12. The first script defines a class whose __reduce__ method returns os.system and a shell command that creates a marker file. It assigns an instance to f.root._v_attrs.description in a new HDF5 file, which pickles the object into an attribute. Crafting the file executes nothing.
The second script is stock PyTables. It opens the file in read mode and reads f.root._v_attrs.description. According to the advisory, the marker file appears only after that read.
Both scripts are attached to the advisory as pytables_attacker.py and pytables_victim.py. We describe them in words and do not reprint them, because no fixed release exists yet.
Portability is the detail that makes the file dangerous in practice. The advisory notes that the stored pickle references posix.system, the function behind os.system. The payload therefore "needs none of the attacker's classes on the victim side". Injected commands run with the rights of the process that opened the file.
The advisory's impact line says where to look for exposure. It calls opening an untrusted .h5 file "a routine operation, for example in data pipelines, ML services, notebooks, or via pandas.read_hdf".
Dependency scanners gave no hint. The advisory records that pip-audit on 3.11.1 "reported no known vulnerabilities" at the time of the report.
A second path through ObjectAtom and VLArray
Attributes are not the only place where PyTables unpickles file content. The advisory text covers attributes alone. The code shows another sink in tables/atom.py, where ObjectAtom stores arbitrary Python objects inside variable-length arrays.
def fromarray(self, array: np.ndarray) -> Any | None:
"""Deserialize data contained in the input array.
A Python object is returned.
"""
# We have to check for an empty array because of a possible
# bug in HDF5 which makes it claim that a dataset has one
# record when in fact it is empty.
if array.size == 0:
return None
return pickle.loads(array.tobytes())
tables/atom.py, lines 1380 to 1390, commit 6508c4d. Source.
ObjectAtom.fromarray passes the array bytes to pickle.loads() with no check at all. Reading rows of a VLArray that uses ObjectAtom therefore loads pickles from the file as well. This path is our reading of the diff, and the same merge commit gates it.
In the merged tables/vlarray.py, VLArray.read consults self._v_file.params["ALLOW_PICKLE"] first. With the flag off and data present it raises PickleNotAllowedError. With the flag on it wraps the call in _allow_object_unpickling(). That context manager sets a ContextVar named _object_unpickling_allowed, whose default is False.
In the new atom.py, ObjectAtom.fromarray gained a keyword-only allow_pickle argument on lines 1406 to 1424. Direct calls now deny loading unless that context is active.
What merge commit 8ae7154 changes
Antonio Valentino merged the branch yuuluo/ghsa-3r7g-mq96-7hhc-fix on October 3, 2026, at 15:02:48 UTC. The merge commit 8ae7154191676c2ab12ba36450972d0be77efde3 has two parents, 6508c4d and ab7c244. GitHub's API lists no pull request for it. The advisory went public 38 minutes later, at 15:40:53 UTC, under Valentino's account avalentino.
Against its first parent the merge touches 24 files, with 709 lines added and 49 removed. Ten runtime files account for 291 additions and 36 deletions. Five test files add 371 lines and remove one, including a new tables/tests/test_pickle.py of 315 lines. Nine documentation and example files make up the remaining 47 additions and 12 deletions.
| Runtime file | Added | Removed |
|---|---|---|
tables/ptpickle.py (new) |
90 | 0 |
tables/attributeset.py |
51 | 28 |
tables/atom.py |
37 | 3 |
tables/parameters.py |
27 | 0 |
tables/file.py |
26 | 0 |
tables/exceptions.py |
24 | 0 |
tables/vlarray.py |
23 | 2 |
tables/scripts/ptdump.py |
10 | 1 |
tables/__init__.py |
2 | 0 |
tables/hdf5extension.pyx |
1 | 2 |
The centre of the patch is small. The heuristic stays exactly as it was. PyTables now reads a policy flag from the open file and checks it before any load.
@@ -330,11 +334,14 @@ def __getattr__(self, name: str) -> Any:
and value.itemsize > 0
and value.endswith(b".")
)
+ allow_pickle = self._v__nodefile.params["ALLOW_PICKLE"]
if maybe_pickled and value in [b"0", b"0."]:
# Workaround for a bug in many versions of Python (starting
# somewhere after Python 2.6.1). See ticket #253.
retval = value
+ elif maybe_pickled and not allow_pickle:
+ retval = value
elif (
maybe_pickled
and _field_fill_re.match(name)
@@ -343,7 +350,7 @@ def __getattr__(self, name: str) -> Any:
# This format was used during the first 1.2 releases, just
# for string defaults.
try:
- retval = pickle.loads(value)
+ retval = pickle.loads(value, allow_pickle=allow_pickle)
retval = np.array(retval)
except ImportError:
retval = None # signal error avoiding exception
@@ -356,10 +363,12 @@ def __getattr__(self, name: str) -> Any:
# This is a big hack, but we don't have other way to recognize
# pickled filters of PyTables 1.x files.
value = _old_filters_re.sub(_new_filters_sub, value, 1)
- retval = pickle.loads(value) # pass unpickling errors through
+ retval = pickle.loads(
+ value, allow_pickle=allow_pickle
+ ) # pass unpickling errors through
elif maybe_pickled:
try:
- retval = pickle.loads(value)
+ retval = pickle.loads(value, allow_pickle=allow_pickle)
tables/attributeset.py, merge commit 8ae7154 against its first parent 6508c4d. Source.
Line 337 of the new file reads allow_pickle from self._v__nodefile.params["ALLOW_PICKLE"]. A new branch on lines 343 and 344 returns the raw bytes when the value looks pickled and the flag is off. All five pickle.loads calls (lines 353, 366, 371, 384 and 391) now carry allow_pickle=allow_pickle. The name pickle itself changed meaning, since line 13 now reads from . import ptpickle as pickle.
if type(allow_pickle) is not bool:
raise TypeError("allow_pickle must be a bool")
if not allow_pickle:
raise PickleNotAllowedError(
"automatic unpickling is disabled; reopen the file with "
"allow_pickle=True only if the file is trusted"
)
tables/ptpickle.py, lines 72 to 78, commit 8ae7154. Source.
The wrapper module tables/ptpickle.py is 90 lines long. Its loads() defaults to allow_pickle=False and raises PickleNotAllowedError before any opcode is evaluated. A non-boolean flag raises TypeError.
The companion dumps() emits a PickleSecurityWarning on lines 33 to 38 each time PyTables serializes an object. Writing pickles stays enabled.
Both new exception types sit in tables/exceptions.py. PickleNotAllowedError derives from ValueError, and PickleSecurityWarning derives from Warning. A new tuple, _UNPICKLE_FATAL_ERRORS, groups PickleNotAllowedError, MemoryError and RecursionError. The old catch-all handlers now re-raise those three and no longer swallow them.
File.__init__ validates the flag once per file handle, on lines 806 to 817 of tables/file.py. It emits a PickleSecurityWarning only when the caller passes allow_pickle=True explicitly, because a warning on every open_file() "would be too noisy".
The command-line tool ptdump received an --allow-pickle option and otherwise opens files with allow_pickle=False. Two housekeeping edits complete the runtime set. hdf5extension.pyx swaps its import pickle for the wrapper. tables/__init__.py exports the two new names, so callers can catch tables.PickleNotAllowedError.
Off by default for 44 hours, inside the fix branch
The merged branch contains seven patches written between August 15 and August 17, 2026. Valentino authored the first four and YuuLuo the last three.
| Patch | Subject | Author | Author date |
|---|---|---|---|
1/7 08cd78b |
Isolate pickle functionalities into a dedicated module | Antonio Valentino | Aug 15, 2026, 10:08:10 +0200 |
2/7 dca4986 |
New ALLOW_PICKLE parameter | Antonio Valentino | Aug 15, 2026, 11:41:43 +0200 |
3/7 73a8f06 |
Deprecate the use of pickle | Antonio Valentino | Aug 15, 2026, 10:09:19 +0200 |
4/7 9f6e29e |
Restricted unpickler | Antonio Valentino | Aug 15, 2026, 10:04:10 +0200 |
5/7 a59e611 |
Disable automatic unpickling by default | YuuLuo | Aug 15, 2026, 20:41:21 +0800 |
6/7 926cf3c |
Warn when serializing pickle data | YuuLuo | Aug 16, 2026, 01:51:41 +0800 |
7/7 ab7c244 |
Keep ALLOW_PICKLE enabled by default | YuuLuo | Aug 17, 2026, 17:13:16 +0800 |
Patch 5 switched the default off. Its subject reads "Disable automatic unpickling by default", and its author date is August 15 at 20:41:21 (UTC+8). Patch 7, "Keep ALLOW_PICKLE enabled by default", reversed that on August 17 at 17:13:16 in the same time zone.
About 44 hours separate the two commits. Neither message has a body, so the patches themselves give no reason beyond the word compatibility in the documentation.
ALLOW_PICKLE: bool = True
"""Globally allow/disallow automatic unpickling when reading files.
Pickle payloads can execute arbitrary code while they are loaded.
Automatic unpickling remains enabled by default in PyTables 3.12 for
compatibility. Disable it for untrusted files, or globally for new file
handles. The default is expected to change to false in a future release.
tables/parameters.py, lines 445 to 451, commit 8ae7154. Source.
ALLOW_PICKLE is True in the merged code. A program that upgrades to this code and changes nothing else keeps the exact behavior of 3.11.1. The GitHub advisory pairs that default with an affected range of <= 3.12 and names no patched version.
A stricter design appeared and vanished inside the same branch. Patch 4 introduced a RestrictedUnpickler with a blocklist of eight modules.
+FORBIDDEN_MODULES: set[str] = {
+ "io",
+ "os",
+ "sys",
+ "json",
+ "pickle",
+ "shutil",
+ "pathlib",
+ "subprocess",
+}
+
+
+SAFE_BUILTINS: set[str] = {
+ "complex",
+ "dict",
+ "list",
+ "tuple",
+}
+
+
+class RestrictedUnpickler(_pickle.Unpickler):
+ def find_class(self, module, name):
+ if module in FORBIDDEN_MODULES or (
+ module == "builtins" and name not in SAFE_BUILTINS
+ ):
+ raise _pickle.UnpicklingError(
+ f"global '{module}.{name}' is forbidden"
+ )
+ return super().find_class(module, name)
Patch 4 of 7, commit 9f6e29e, tables/ptpickle.py. Source.
The class refused globals from io, os, sys, json, pickle, shutil, pathlib and subprocess. From builtins it accepted only complex, dict, list and tuple.
Patch 5 then rewrote ptpickle.py (112 changed lines in its diffstat). The merged file has zero occurrences of RestrictedUnpickler. When the flag is on, loads() calls the standard _pickle.loads with no filtering.
Reading the diff, the blocklist had a gap of its own. It never listed posix, and the advisory says the published payload references posix.system. We did not execute anything to confirm the bypass.
The commit adds an opt-out and leaves the root cause in place. The period heuristic is unchanged on lines 331 to 336, and the default still unpickles. The gate itself sits early, before any pickle opcode runs, in ptpickle.loads().
At least two holes in the opt-out have been closed since the merge. Both appear in the 3.12 release notes at commit 967fb51.
ExternalLink was the first. PyTables opened the linked file with the default policy. A file opened with unpickling disabled "could still have pickles loaded from a second file it links to". Commit a2246a6, dated October 23, 2026, makes the linked file inherit the disabled policy unless allow_pickle is passed to the link call.
copy_file was the second. Its keyword arguments opened only the destination, so copy_file(src, dst, allow_pickle=False) "still read the source with unpickling enabled". A pickled attribute or TITLE in the source "was loaded (executing arbitrary code) during the copy". Commit 7e6cfce fixed that on November 15, 2026, six weeks after the merge.
A CVE with a merged commit usually means upgrade and move on. Here the commit ships with the dangerous default unchanged, so a version number alone will not tell an auditor whether a service is safe. The check that counts is whether every
— AnonHaven Editorial Teamopen_file()andread_hdf()call on outside data passesallow_pickle=False.
The numpy precedent, CVE-2019-6446
NumPy went through the same argument in 2019. The PyTables advisory cites CVE-2019-6446 as prior art. In its words, silent pickle loading in np.load "was accepted as a vulnerability" and numpy "switched allow_pickle to default False". PyTables now uses the same parameter name and, so far, the opposite default.
The trigger here is very broad (any byte attribute ending in '.'), and attributes are ubiquitous metadata.
— PyTables security advisory GHSA-3r7g-mq96-7hhc
Affected versions and fixed builds
Two official records disagree on the affected range. The CVE record, published by GitHub as CNA on November 24, 2026, at 17:07:50 UTC, lists <= 3.11.1. The GitHub advisory lists <= 3.12. The likely reason is that 3.12 adds the switch and leaves it on.
| Item | Value |
|---|---|
| CVE record, affected | <= 3.11.1, no fixed version |
| GitHub advisory, affected | <= 3.12, patched versions none |
| Latest release on PyPI | 3.11.1, uploaded March 1, 2026 |
| Latest GitHub release and tag | v3.11.1, published March 7, 2026 |
| Opt-out available | main from commit 8ae7154, future 3.12 |
| Opt-out gaps closed | a2246a6 (ExternalLink, Oct 23, 2026), 7e6cfce (copy_file, Nov 15, 2026) |
| Unpickling off by default | expected in 3.13, per the release notes |
Version 3.12 does not exist as a release yet. PyPI's newest upload is 3.11.1 from March 1, 2026, and GitHub's newest release and tag is v3.11.1 from March 7.
The advisory and the release notes speak of 3.12 in the present tense anyway. The CVE record states plainly that "No fixed version is available as of this review". No source gives a release date.
The CVSS vector deserves a caveat. GitHub scored the flaw AV:N/AC:L/PR:N/UI:N, which describes a network attack with no user interaction. The published scenario still depends on a victim process opening a hostile file, and neither record explains the scoring. CVSS 4.0 has no score, and the weakness class is CWE-502 (Deserialization of Untrusted Data).
Neither record reports exploitation in the wild. CISA's Known Exploited Vulnerabilities catalog did not list the CVE in the data we pulled on November 25. The CVE ID was reserved on November 20. GitHub last updated the advisory on November 23 at 22:32:04 UTC, and the record went public a day later.
Two bookkeeping gaps may confuse scanners. OSV returned no record for the ID GHSA-3r7g-mq96-7hhc on November 25 and offered only the alias CVE-2026-134019. The CVE record links the release notes at commit 967fb51, not at the merge commit 8ae7154.
What to do before 3.12 ships
Start with an inventory. Run pip show tables in every environment that reads HDF5 files. Any version up to 3.11.1 is vulnerable and has no ALLOW_PICKLE parameter. The advisory offers no official workaround for those versions.
Do not assume the keyword protects an old install. At parent commit 6508c4d, File.__init__ uppercases keyword arguments and merges them into its parameter dictionary on lines 790 and 791. Nothing in the old attributeset.py reads an ALLOW_PICKLE key. We did not run the old code with the flag, but the source gives it no effect on unpickling.
For 3.11.1 the only reliable control is the origin of the file. Keep .h5 files from uploads, shared buckets, email and public datasets away from tables.open_file() and pandas.read_hdf(). Where such files must be read, do it in a disposable sandbox with no credentials.
Installs built from main can be recognised by two markers. The file tables/ptpickle.py exists, and tables/parameters.py defines ALLOW_PICKLE. Both appear from commit 8ae7154 onward.
Commit 8ae7154 alone is not enough. A build older than 7e6cfce (November 15, 2026) still unpickles the source file in copy_file despite allow_pickle=False. A build older than a2246a6 (October 23) still does so through ExternalLink. Build from a revision that contains both, then use the advisory's per-file opt-out.
import tables
with tables.open_file("untrusted.h5", allow_pickle=False) as h5file:
...
Per-file opt-out from advisory GHSA-3r7g-mq96-7hhc. Source.
A global setting covers code you cannot edit call by call.
import tables
tables.parameters.ALLOW_PICKLE = False
Global opt-out from the same advisory. Source.
The global parameter has a limit spelled out in parameters.py. It applies to files opened afterwards without an explicit allow_pickle argument. It "does not change the policy of files that are already open". Set it at process start, before any import that opens a store.
Pandas users pass the same flag through. The advisory names pandas.read_hdf(..., allow_pickle=False) and pandas.HDFStore(..., allow_pickle=False). The pandas source confirms the route, since read_hdf forwards **kwargs to HDFStore and on to tables.open_file.
Expect two visible changes once the flag is off. Pickled attributes come back as raw bytes, and reading ObjectAtom data raises PickleNotAllowedError. Code that stored custom objects in attributes will need a trusted-file path with allow_pickle=True.
The bundled command-line tools are stricter than the library. According to the 3.12 release notes, ptdump and ptrepack keep unpickling disabled unless --allow-pickle is given, and pttree never unpickles. At the merge commit only ptdump had the option. Commit e6865b8 of October 22, 2026, brought the other two in line.
PyTables publishes no indicators of compromise for this flaw. The release notes expect the default to change to disabled in PyTables 3.13. Until that release lands, grep your codebase for open_file(, read_hdf( and HDFStore(, and add allow_pickle=False wherever the file comes from someone else.
- Contents are built when the page loads