php / php/php-src

OpenSSL config path does not respect open_basedir restriction

Aperta
#9,317 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Extension: openssl
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal punto di ingresso openssl_pkey_new() e segui come viene gestita la sua opzione esplicita 'config' con open_basedir. Verifica che un percorso di configurazione al di fuori della restrizione venga rifiutato, mentre il percorso predefinito rimanga invariato, quindi aggiungi una copertura di regressione per entrambi i casi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c, php
Ambito
security
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.