summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-06-17 10:33:05 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-06-17 10:33:05 -0300
commit9ddd3418dad5648d4435a45c14d085048ad51a9f (patch)
tree8ca33499afdeed13165fa8d79b24256bc958af69
parentaa27de6e78ae42d268bd4a53fd0bbe755425e561 (diff)
downloadpfsense-9ddd3418dad5648d4435a45c14d085048ad51a9f.zip
pfsense-9ddd3418dad5648d4435a45c14d085048ad51a9f.tar.gz
Avoid directory traversal when reading package xml files, also check if file exists before try to read it
-rwxr-xr-xusr/local/www/pkg_edit.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php
index 0e8cb96..faefc7d 100755
--- a/usr/local/www/pkg_edit.php
+++ b/usr/local/www/pkg_edit.php
@@ -65,9 +65,14 @@ function domTT_title($title_msg){
$xml = htmlspecialchars($_GET['xml']);
if($_POST['xml']) $xml = htmlspecialchars($_POST['xml']);
-if($xml == "") {
+$xml = basename($xml);
+
+if ($xml == "") {
print_info_box_np(gettext("ERROR: No package defined."));
die;
+} else if (!file_exists('/usr/local/pkg/' . $xml)) {
+ print_info_box_np(gettext("ERROR: XML file not found"));
+ die;
} else {
$pkg = parse_xml_config_pkg("/usr/local/pkg/" . $xml, "packagegui");
}
OpenPOWER on IntegriCloud