Skip to content

Commit ea97b6d

Browse files
committed
Updates php/challenge-65.md
Auto commit by GitBook Editor
1 parent b57a484 commit ea97b6d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

php/challenge-65.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ $challenge = new Challenge($_FILES['solution']);
2424
```
2525

2626
# Solution
27+
The challenge contains an arbitrary file upload vulnerability in line 13. The operation in_array() is used in line 12 to check if the file name is a number. However, it is type-unsafe because the third parameter is not set to 'true'. Hence, PHP will try to type-cast the file name to an integer value when comparing it to the array $whitelist (line 8). As a result it is possible to bypass the whitelist by prepending a value in the range of 1 and 24 to the file name, for example "5backdoor.php". The uploaded PHP file then leads to code execution on the web server.
2728

2829
# Refference
2930
+ php-security-calendar-2017 Day 1 - Wish List

0 commit comments

Comments
 (0)