php / php/php-src

OpenSSL config path does not respect open_basedir restriction

Offen
#9,317 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bug Extension: openssl
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.1k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

Description

Currently the config in options passed to some functions is not checked if it is inside open_basedir restriction. This should be probably fixed just in master as it is not usually a big issue considering that the config is basically read only and some user flows might have relied on it being in the system path so we don't want to break them in a patch release. However we should still confirm to the open_basedir rules and prohibit it in master branch. One thing to note that this should not be applied on the default path as it would be too big break for not a big gain.

The following code:

<?php
// cert path (existing cert)
$config= "$file_path/openssl.cnf";

ini_set('open_basedir', "$file_path/config");

$pkey= openssl_pkey_new([
    'config' => $config
]);

var_dump($pkey);

Resulted in this output:

object...

But I expected this output instead:

possibly warning
bool(false)
PHP Version

Any

Operating System

Any

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne am Einstiegspunkt openssl_pkey_new() und verfolge, wie dessen explizite Option 'config' unter open_basedir behandelt wird. Überprüfe, dass ein Konfigurationspfad außerhalb der Einschränkung abgelehnt wird, während der Standardpfad unbeeinträchtigt bleibt, und füge anschließend Regressionstests für beide Fälle hinzu.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, php
Bereich
security
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.