php / php/php-src

PDO\Sqlite::loadExtension loads arbitrary shared objects

Open
#22,034 0 comments 0 reactions 1 assignee View on GitHub

@SakiTakamachi is already working on this.

Since May 13, 2026.

Bug Extension: pdo_sqlite Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

Unlike SQLite3::loadExtension, Pdo\Sqlite::loadExtension does not check sqlite3.extension_dir and calls sqlite3_load_extension with the absolute path to the extension parameter. This allows executing native code from PHP code subject to open_basedir / disable_functions (which are not security boundaries anyway).

https://github.com/php/php-src/blob/769441ba430995733d2ad21727d51b1ace115317/ext/pdo_sqlite/pdo_sqlite.c#L102-L113

I'll open a PR with my patch later this week. It introduces a similar check to SQLite3::loadExtension and restricts extension loading to a trusted directory (sqlite3.extension_dir) set in advance.

PHP Version
PHP 8.6.0-dev (cli) (built: May 10 2026 23:58:07) (NTS)
Copyright © The PHP Group and Contributors
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
    with Zend OPcache v8.6.0-dev, Copyright ©, by Zend by Perforce
Operating System

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.