---
title: "CodeVerifier admits string-to-code execution…"
description: "GHSA-jrxf-9jh4-86w7: CodeVerifier admits string-to-code execution (timeit, cProfile, pdb, code) and file access… Affected and fixed versions of qwed."
url: https://qwedai.tech/security/advisories/ghsa-jrxf-9jh4-86w7
---

[Security](https://qwedai.tech/security) · [Advisories](https://qwedai.tech/security/advisories) · GHSA-jrxf-9jh4-86w7

# CodeVerifier admits string-to-code execution (timeit, cProfile, pdb, code) and file access (tarfile, zipfile, gzip, codecs, linecache, builtins.open, os.listdir) (incomplete fix of GHSA-4phf-6h72-9xfg)

high Fixed in 9.0.0 GHSA-jrxf-9jh4-86w7 · Published 6 November 2026

## Impact

`CodeVerifier.verify_code(code, "python")` returns `VERIFIED · ADMIT` (`is_valid: true`, no issues) for Python code that runs caller-supplied strings as code, or that reads, writes or lists files. It does this through standard-library modules missing from the pattern tables.

GHSA-6rxr-gq43-694g and GHSA-4phf-6h72-9xfg made `eval`/`exec`, process execution, `open()`, `pathlib`, `shutil` and network access CRITICAL. These equivalent forms are still admitted on 8.0.0:

**String-to-code execution** (equivalent to `eval(input())`, which is blocked):

| Code | 8.0.0 |
| --- | --- |
| `timeit.timeit(input(), number=1)` | `VERIFIED · ADMIT` |
| `cProfile.run(input())` | `VERIFIED · ADMIT` |
| `pdb.run(input())` | `VERIFIED · ADMIT` |
| `code.InteractiveInterpreter().runsource(input())` | `VERIFIED · ADMIT` |

**File access** (equivalent to `open(...)`, which is blocked):

| Code | 8.0.0 |
| --- | --- |
| `tarfile.open(p).extractall()` | `VERIFIED · ADMIT` |
| `zipfile.ZipFile(p).extractall()` | `VERIFIED · ADMIT` |
| `gzip.open("/etc/passwd").read()` | `VERIFIED · ADMIT` |
| `builtins.open("/etc/passwd").read()` | `VERIFIED · ADMIT` |
| `codecs.open("/etc/passwd").read()` | `VERIFIED · ADMIT` |
| `linecache.getline("/etc/passwd", 1)` | `VERIFIED · ADMIT` |
| `os.listdir("/")` | `VERIFIED · ADMIT` |

Controls: `eval(input())`, `os.system("ls")` and `open("x").read()` are blocked.

A caller that runs code only after QWED admits it (an agent tool gate, a CI check, a sandbox pre-filter) will run arbitrary code or expose files.

## Affected

`qwed` (PyPI) through 8.0.0. Reproduced on `main` @ `10f5627` (unchanged since 8.0.0).

Reachable from:

-   `POST /verify/code`;
-   `code` items in `POST /verify/batch`;
-   `CodeVerifier.verify_code` and `verify_python_deep`;
-   the SDK paths that delegate to `CodeVerifier`.

## Reproduction

```python
from qwed_new.core.code_verifier import CodeVerifier

cv = CodeVerifier()
for code in ["import timeit\ntimeit.timeit(input(), number=1)",
             "import pdb\npdb.run(input())",
             "import tarfile\ntarfile.open(p).extractall()",
             "import builtins\ndata = builtins.open('/etc/passwd').read()",
             "eval(input())"]:                                   # control
    r = cv.verify_code(code, "python")
    print(r.status.value, r.developer_fields.get("is_valid"), [i.get("type") for i in r.developer_fields["issues"]])
```

The first four print `VERIFIED True []`; the control prints `VERIFIED False ['dangerous_function']`. Nothing was executed during testing; the verifier only analyses the text.

## Details

`src/qwed_new/core/code_verifier.py`:

-   **`PYTHON_CRITICAL` (lines 74-87)** lists `eval`, `exec`, `compile` and `__import__`, but not the standard-library entry points that compile and run a string: `timeit.timeit`/`timeit.repeat`/`timeit.Timer`, `cProfile.run`/`runctx`, `profile.run`, `pdb.run`/`runeval`/`runcall`, `code.interact`, `code.InteractiveInterpreter.runsource`/`runcode` and `code.InteractiveConsole.push`.
-   **`PYTHON_FILE_NETWORK` (lines 154-169)** lists `open`, `pathlib` and `shutil` operations, but not `tarfile`, `zipfile`, `gzip`, `bz2`, `lzma`, `codecs.open`, `linecache`, `fileinput`, `io.open`, `builtins.open` (attribute access to the blocked builtin), `os.listdir`/`os.scandir`/`os.walk` or `glob`.
-   The AST pass resolves import aliases for listed names only, so a module that is not listed is never examined.

## Patches

Fixed in 9.0.0 ([`9e647d0`](https://github.com/QWED-AI/qwed-verification/commit/9e647d0b963934400d65b629139ec594a941dafb) ). Upgrade to 9.0.0 or later.

-   Importing a module that runs a string as code is refused, in every import form: `timeit`, `cProfile`, `profile`, `pdb`, `bdb`, `code`, `codeop`, `trace`, `doctest`, `logging.config` and `idlelib`. `logging.config` is also refused when read as an attribute. The import is refused rather than the call, because the run functions can also be reached through an alias, an instance or a stored reference.
-   The file-access table gains `tarfile`, `zipfile`, the `gzip`, `bz2` and `lzma` file opens, `codecs.open`, `linecache`, `fileinput`, `os.listdir`, `os.scandir`, `os.walk`, `os.fwalk`, `os.stat`, `os.lstat`, `glob`, `tempfile`, `sqlite3.connect`, `shelve`, `dbm`, `pkgutil.get_data` and `importlib.resources`.

On 9.0.0 every row of both tables above is `VERIFIED`, `is_valid: false`, `BLOCKED` (`dangerous_function` or `file_or_network_access`).

The pattern tables are still a denylist: a module they do not list is not refused.

## Workarounds

Upgrade to 9.0.0. In any version, do not run code solely because `verify_code` admitted it; keep an OS-level sandbox (no filesystem, no network) as the primary control.

## Source

Internal correctness audit (October 2026). Not previously disclosed.

[All advisories](https://qwedai.tech/security/advisories)

Affected and fixed

qwed

Affected <= 8.0.0 Fixed in 9.0.0

Weakness

CWE-94 Improper Control of Generation of Code CWE-184 Incomplete List of Disallowed Inputs

[View on GitHub](https://github.com/QWED-AI/qwed-verification/security/advisories/GHSA-jrxf-9jh4-86w7)
