File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -426,7 +426,7 @@ function image_drop_upload_ajax() {
426
426
function image_delete_ajax () {
427
427
428
428
$ document = $ _POST ['document ' ];
429
- $ image_filename = $ _POST ['image_name ' ];
429
+ $ image_filename = basename ( $ _POST ['image_name ' ]); // added basename()
430
430
431
431
if (Session::getInstance ()->autenticationLevel () != 2 ) {
432
432
// error
@@ -435,6 +435,20 @@ function image_delete_ajax() {
435
435
return false ;
436
436
}
437
437
438
+ // reject if $document contains .. or any slash/backslash
439
+ if (
440
+ strpos ($ document , '.. ' ) !== false ||
441
+ strpos ($ document , '/ ' ) !== false ||
442
+ strpos ($ document , '\\' ) !== false
443
+ ) {
444
+ echo json_encode ([
445
+ "error " => 1 ,
446
+ "code " => "invalid_document "
447
+ ]);
448
+ return false ;
449
+ }
450
+
451
+
438
452
// initialize document
439
453
$ DOC = new Document ($ document );
440
454
if (!is_dir ($ DOC ->DIR )){mkdir ($ DOC ->DIR ,0755 ,true );}
@@ -461,7 +475,6 @@ function image_delete_ajax() {
461
475
}
462
476
}
463
477
464
-
465
478
/**
466
479
* Atachment Upload (AJAX)
467
480
*/
You can’t perform that action at this time.
0 commit comments