Fixed vulnerability.

view-source: codiad/data/users.php
nginx with fast cgi will disclose the commented out json unless you add a new line before hand.
Fixes username, password "sha1(md5(password))", and last project from being disclosed to public.
This commit is contained in:
Chad
2017-01-17 18:43:03 -05:00
committed by GitHub
parent c42d24cb48
commit 6e2ff815f1

View File

@@ -180,6 +180,7 @@
}
$json = file_get_contents($path . $file);
$json = str_replace(["\n\r", "\r", "\n"], "", $json);
$json = str_replace("|*/?>","",str_replace("<?php/*|","",$json));
$json = json_decode($json,true);
return $json;
@@ -197,7 +198,7 @@
if(!is_dir($path)) mkdir($path);
}
$data = "<?php/*|" . json_encode($data) . "|*/?>";
$data = "<?php\r\n/*|" . json_encode($data) . "|*/\r\n?>";
$write = fopen($path . $file, 'w') or die("can't open file ".$path.$file);
fwrite($write, $data);
fclose($write);