-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathphpobjectinjection.php
62 lines (38 loc) · 1.12 KB
/
phpobjectinjection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
#https://www.owasp.org/index.php/PHP_Object_Injection
#https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Insecure%20Deserialization/PHP.md
#https://omercitak.com/php-object-injection/
include "includer.php";
#echo serialize(array("name","eticin"));
class aburcubur{
public $name;
function __construct(){
}
function __wakeup(){
if(isset($this->name)){
eval($this->name);
}
}
}
?>
<div class=container>
<h1>PHP Object Injection</h1>
<form method="GET">
<label>AburCubur Name:</label>
<input type="text" name="name" value='a:2:{i:0;s:4:"name";i:1;s:6:"eticin";}'><br>
<button type="submit" name="form">SEND</button>
</form>
<?php
if(isset($_GET['name'])){
$var1=unserialize($_GET['name']);
if(is_array($var1))
echo "<br>".$var1[0]." - ".$var1[1];
}
?>
</div>
<!--
a:2:{i:0;s:4:"name";i:1;s:25:"<script>alert(1)</script>";}
O:9:"aburcubur":1:{s:4:"name";s:17:"system('whoami');";}
Prevention:
Don't use unserialize function. You should use JSON(Java Script Object Notation) for keeping your data.
-->