Skip to content

Commit 3926e81

Browse files
committed
Merge pull request #243 from robre/patch-1
XSS Patch for mf_upload.php
2 parents 42217a2 + 29bc6a9 commit 3926e81

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

admin/mf_upload.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ function valid_mime($mime,$file_type){
110110
<script type="text/javascript" charset="utf-8">
111111
var mf_par = window.parent;
112112
var mf_js = <?php echo json_encode($resp); ?>;
113-
mf_par.<?php echo $_POST['callback']; ?>(mf_js);
113+
mf_par.<?php echo htmlspecialchars($_POST['callback'], ENT_QUOTES, 'UTF-8'); ?>(mf_js);
114114

115115
var par = window.parent.document;
116-
var iframe = par.getElementById('iframe_upload_<?php echo $_POST["input_name"]?>');
116+
var iframe = par.getElementById('iframe_upload_<?php echo htmlspecialchars($_POST['input_name'], ENT_QUOTES, 'UTF-8');?>');
117117
iframe.style.display="";
118118
</script>
119119
<?php } ?>
@@ -143,11 +143,11 @@ function valid_mime($mime,$file_type){
143143
function upload(){
144144
// hide old iframe
145145
var par = window.parent.document;
146-
var iframe = par.getElementById('iframe_upload_<?php echo $_GET["input_name"]?>');
146+
var iframe = par.getElementById('iframe_upload_<?php echo htmlspecialchars($_GET['input_name'], ENT_QUOTES, 'UTF-8');?>');
147147
iframe.style.display="none";
148148

149-
par.getElementById("response-<?php echo $_GET['input_name'];?>").style.display = "block";
150-
par.getElementById("response-<?php echo $_GET['input_name'];?>").innerHTML = "Transferring ";
149+
par.getElementById("response-<?php echo htmlspecialchars($_GET['input_name'], ENT_QUOTES, 'UTF-8');?>").style.display = "block";
150+
par.getElementById("response-<?php echo htmlspecialchars($_GET['input_name'], ENT_QUOTES, 'UTF-8');?>").innerHTML = "Transferring ";
151151
setTimeout("transferring(0)",1000);
152152
// send
153153
document.iform.submit();
@@ -161,8 +161,8 @@ function transferring(dots){
161161

162162
var par = window.parent.document;
163163
// update progress
164-
if (par.getElementById("response-<?php echo $_GET['input_name'];?>").innerHTML.substring(0,5) != "Trans") return;
165-
par.getElementById("response-<?php echo $_GET['input_name'];?>").innerHTML = newString;
164+
if (par.getElementById("response-<?php echo htmlspecialchars($_GET['input_name'], ENT_QUOTES, 'UTF-8');?>").innerHTML.substring(0,5) != "Trans") return;
165+
par.getElementById("response-<?php echo htmlspecialchars($_GET['input_name'], ENT_QUOTES, 'UTF-8');?>").innerHTML = newString;
166166
if (dots == 4) dots = 0; else dots = dots + 1;
167167
setTimeout("transferring("+dots+")",1000) ;
168168

@@ -174,10 +174,10 @@ function transferring(dots){
174174
<label for="file" class="label-file"><?php _e('File', $mf_domain); ?>:</label><br />
175175
<input id="file" type="file" name="file" onchange="upload()" class="mf-file" />
176176
<?php wp_nonce_field('nonce_upload_file','checking'); ?>
177-
<input type="hidden" name="input_name" value="<?php echo $_GET["input_name"]?>" />
178-
<input type="hidden" name="callback" value="<?php echo $_GET["callback"]?>" />
177+
<input type="hidden" name="input_name" value="<?php echo htmlspecialchars($_GET['input_name'], ENT_QUOTES, 'UTF-8')?>" />
178+
<input type="hidden" name="callback" value="<?php echo htmlspecialchars($_GET['callback'], ENT_QUOTES, 'UTF-8')?>" />
179179
<input type="hidden" name="fileframe" value="true" />
180-
<input type="hidden" name="type" value="<?php echo $_GET["type"]?>" />
180+
<input type="hidden" name="type" value="<?php echo htmlspecialchars($_GET['type'], ENT_QUOTES, 'UTF-8')?>" />
181181
</form>
182182
</body>
183183
</html>

0 commit comments

Comments
 (0)