Author: Maksymilian Arciemowicz from https://cxsecurity.com
Issue type: CWE-295
Source URL:
http://cxsecurity.com/issue/
--- Description ---
As we can read
CURLOPT_SSL_VERIFYPEER option.
http://curl.haxx.se/libcurl/c/
WARNING: disabling verification of the certificate allows bad guys to man-in-the-middle the communication without you knowing it. Disabling verification makes the communication insecure. Just having encryption on a transfer is not enough as you cannot be sure that you are communicating with the correct end-point.
CURLOPT_SSL_VERIFYHOST option.
http://curl.haxx.se/libcurl/c/
When the verify value is 0, the connection succeeds regardless of the names in the certificate. Use that ability with caution!
--- MItM in libraries/Config.class.php ---
Let's see libraries/Config.class.php file
------------------------------
https://github.com/phpmyadmin/
..
// check if commit exists in Github
if ($commit !== false
&& isset($_SESSION['PMA_VERSION_
) {
$is_remote_commit = $_SESSION['PMA_VERSION_
} else {
$link = 'https://api.github.com/repos/
. $hash;
$is_found = $this->checkHTTP($link, ! $commit);
..
$link = 'https://api.github.com/repos/
. '/git/trees/' . $branch;
$is_found = $this->checkHTTP($link);
..
------------------------------
where checkHTTP() is vulnerable for MItM attack
https://cwe.mitre.org/data/
------------------------------
..
function checkHTTP($link, $get_body = false)
{
if (! function_exists('curl_init')) {
return null;
}
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); <=============== MItM
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); <=============== MItM
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_USERAGENT, 'phpMyAdmin/' . PMA_VERSION);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
if (! defined('TESTSUITE')) {
session_write_close();
}
$data = @curl_exec($ch);
if (! defined('TESTSUITE')) {
ini_set('session.use_only_
ini_set('session.use_cookies', '0');
ini_set('session.use_trans_
ini_set('session.cache_
session_start();
}
if ($data === false) {
return null;
}
$httpOk = 'HTTP/1.1 200 OK';
$httpNotFound = 'HTTP/1.1 404 Not Found';
..
------------------------------
Example target URL:
https://api.github.com/repos/
--- Credit ---
Issue discovered by Maksymilian Arciemowicz from http://cxsecurity.com by using cIFrex (static code analysis tool http://cifrex.org ).
--- Patch ---
http://www.phpmyadmin.net/
http://cxsecurity.com/issue/
Komentarų nėra:
Rašyti komentarą