From 9e0c125f8fe65e494a20430183d5356d17b3c9c7 Mon Sep 17 00:00:00 2001 From: Yoshihiro Yamazaki Date: Tue, 22 Dec 2020 23:47:56 +0900 Subject: [PATCH] fixing to XSS vulnerability. --- www/define.php | 11 +++++++++++ www/index.php | 2 +- www/swfimage.php | 4 ++-- www/swfimagelist.php | 2 +- www/swfimagereplace.php | 14 +++++++------- www/swfshape.php | 8 ++++++-- 6 files changed, 28 insertions(+), 13 deletions(-) diff --git a/www/define.php b/www/define.php index be64d45..41f98f5 100644 --- a/www/define.php +++ b/www/define.php @@ -1,3 +1,14 @@ @@ -94,9 +94,9 @@ FORM; exit(0); } -$id = $_REQUEST['id']; -$image_id = $_REQUEST['image_id']; -$id_image = $_REQUEST['id_image']; +$id = hex_from_string($_REQUEST['id']); +$image_id = dec_from_string($_REQUEST['image_id']); +$id_image = hex_from_string($_REQUEST['id_image']); $ext = $_REQUEST['ext']; if (($ext != '.jpg') && ($ext != '.png') && ($ext != '.gif')) { diff --git a/www/swfshape.php b/www/swfshape.php index 408eb5d..c411e62 100644 --- a/www/swfshape.php +++ b/www/swfshape.php @@ -2,9 +2,13 @@ require_once('define.php'); -$id = $_REQUEST['id']; -$shape_id = $_REQUEST['shape_id']; +$id = hex_from_string($_REQUEST['id']); +$shape_id = dec_from_string($_REQUEST['shape_id']); $ext = $_REQUEST['ext']; +if (($ext != '.jpg') && ($ext != '.png') && ($ext != '.gif')) { + echo "unknown ext=($ext)..\n"; + exit(1); +} $shape_filename = "$tmp_prefix$id-$shape_id$ext"; $shape_data = file_get_contents($shape_filename); -- 2.11.0