Follow us on Twitter!
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill
Wednesday, April 23, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 15
Guests Online: 14
Members Online: 1

Registered Members: 82876
Newest Member: bhl1986
Latest Articles
View Thread

HellBound Hackers | Computer General | Increasing Security

Page 2 of 7 < 1 2 3 4 5 > >>
Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 19:13
yours is just as easy to crack, even easier when i know the fonts you used Smile
but still your right it is crackebale, but i use it to secure my guestbook against spam and the registration form, not fort knox

btw try to crack it ^^ i always wonderd if someone could


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 19:15
AldarHawk wrote:
Once again, Easily cracked.

All I would have to do is write a bot to decipher the two colors and POOF instant crack.


Not necessarily. I've got a CAPTCHA in the works right now, and I'm willing to bet nobody will be able to crack it, despite the whole 'theoretically able to crack'. In fact, I'll offer anyone 100 bucks to build a bot to crack it. The color isn't really that big of an issue really as font and other things are. The one I'm building has random font, random position, random size, random lines (not an insane/overkill amount either). I'm just fixing a few issues then I will post the image and source here for someone to try their luck at cracking it Wink.

sacman wrote:
yours is just as easy to crack, even easier when i know the fonts you used Smile


Exactamundo Wink




Edited by on 05-09-08 19:16
Author

RE: CAPTCHA Questions

spyware
Member



Posts: 4192
Location: The Netherlands
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 05-09-08 19:59
slpctrl wrote:
I'm willing to bet nobody will be able to crack it, despite the whole 'theoretically able to crack'.


Nobody?



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
“Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?” - Ebert
[/s
http://bitsofspy.net
Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 20:04
spyware wrote:
slpctrl wrote:
I'm willing to bet nobody will be able to crack it, despite the whole 'theoretically able to crack'.


Nobody?


Nobody here I'm willing to bet. Imma post the source and everything here, free for anyone to attempt to crack. There will be a reward for anyone willing to crack it, the problem is that I have it selecting random fonts, so I'm not sure how a bot would be able to crack it at all but you're all free to try.

captcha.php (creates the image)

Code

<?php
session_start();
$str1 = md5(microtime() * mktime());
$str = substr($str1,0,5);
$captcha = imagecreatefrompng("./captcha.png");
$black = imagecolorallocate($captcha,0,0,0);
$line = imagecolorallocate($captcha,rand(0,250),rand(0,239),rand(0,240));
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$line);
imagestring($captcha,rand(1,5),rand(0,100),rand(0,50),$str,$black);
$_SESSION['str'] = md5($str);
header("Content-type: image/png");
imagepng($captcha);
?>





code.php (creates the form, SRCs the image and checks for matching text)
Code

<?php
session_start();
echo <<<HTML
<html>
<head>
<title>Captcha</title>
</head>
<body>
<img src="captcha.php" border="0">
<form action="" method="post">
Enter the text from the image:<br><input type="text" name="code" />
<input type="submit" />
</form>
</body>
</html>
HTML;
if(!$_POST['code'])
die();
else
{
if(md5($_POST['code']) != $_SESSION['str'])
die("Error: Wrong code entered");
else
echo("Correct!");
}
?>





Then all you'd need is a .png image file, whatever background you'd like to use. It's gotta be 200x70 otherwise the text will go off the page etc. I used this image:

slpctrl.freehostia.com/captcha.png it's probably completely unnecessary to have those random blue lines, but it can't hurt. Here is the hosted captcha:

http://slpctrl.freehostia.com/code.php

It is an extremely simple, yet I believe very effective captcha. Anyone that would like to build a bot to crack it is more than welcome, and if I can use the bot to crack it I'll for sure give a reward for it.




Edited by on 05-09-08 20:04
Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 20:04
100 $ nice Smile
everyone or just the first ? ^^


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 20:06
sacman wrote:
100 $ nice Smile
everyone or just the first ? ^^


Well I guess the first person to post the solution. I donno, but for some reason I don't foresee anyone actually coming up with a bot to crack it Grin. I could be wrong though I donno.


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 20:11
sacman wrote:
100 $ nice Smile
everyone or just the first ? ^^


Und nur weil ich die Deutschen LIEBE, werde ich dir ein besonderes Geschenk geben Smile.

So: http://slpctrl.freehostia.com/code.php is mah CAPTCHA. Someone try and crack it Wink.




Edited by on 05-09-08 20:15
Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 20:26
courier & times are 2 of the fonts right ?

du machst es mir sehr einfach mein freund Smile

i'll try to crack it tomorow ^^




Edited by on 05-09-08 20:29
Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 20:32
sacman wrote:
courier & times are 2 of the fonts right ?

du machst es mir sehr einfach mein freund :)


Nah, there are 5 built in ones in imagestring function. Hence:

Code

imagestring($captcha,rand(1,5),rand(0,100),rand(0,50),$str,$black);





Hence the rand(1,5), 1 2 3 4 and 5 represent a different font. I could always use the imageloadfont function with an array of different fonts, but there was a few issues with that; I didn't know what fonts were on the different hosts so I just stuck it out with the 5 default ones from imagestring. Aber wenn es so einfach ist, dann moechte ich dein Loesung sehen!


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 20:46
AFter speaking with sacman, I've decided to modify the code to make it a bit more secure:

Code

<?php
session_start();
$str1 = md5(microtime() * mktime());
$str = substr($str1,0,5);
$captcha = imagecreatefrompng("./captcha.png");
$black = imagecolorallocate($captcha,0,0,0);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(50,200),rand(0,100),rand(50,200),rand(80,200),$black);
imageline($captcha,rand(50,250),rand(0,100),rand(0,200),rand(50,200),$black);
imageline($captcha,rand(70,150),rand(0,100),rand(50,200),rand(0,200),$black);
imageline($captcha,rand(20,150),rand(0,100),rand(20,150),rand(35,200),$black);
imageline($captcha,rand(80,200),rand(0,100),rand(50,200),rand(85,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imagestring($captcha,rand(1,5),rand(0,100),rand(0,50),$str,$black);
$_SESSION['str'] = md5($str);
header("Content-type: image/png");
imagepng($captcha);
?>





I won't modify it anymore. It is crackable, but now it'll be a bit tougher.


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 21:53
slpctrl wrote:
AFter speaking with sacman, I've decided to modify the code to make it a bit more secure...


So, where's his $100?


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 22:13
i didn't crack it ^^


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 22:25
All you'd need to do is use the same microtime as the server (which you would get by parsing through the response headers and making the time into microtime) and then translate the time to mktime as well. Then, just do a post to the page (while using cookies so you retain your session) with the microtime to mktime. Of course, that would be dependent on the response from the http server which will hopefully include the time. If I wasn't lazy, I'd write up some code for it. No need for OCR Grin.

Edit:
Please correct me if this is just stupid.

Edited by on 05-09-08 22:31
Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 23:11
Zephyr_Pure wrote:
slpctrl wrote:
AFter speaking with sacman, I've decided to modify the code to make it a bit more secure...


So, where's his $100?


Yeah, he didn't crack it, he was simply telling me a method to do so. I hear a lot of you talking 'theoretically I could crack that!' :p

hacker2k wrote:
All you'd need to do is use the same microtime as the server (which you would get by parsing through the response headers and making the time into microtime) and then translate the time to mktime as well. Then, just do a post to the page (while using cookies so you retain your session) with the microtime to mktime. Of course, that would be dependent on the response from the http server which will hopefully include the time. If I wasn't lazy, I'd write up some code for it. No need for OCR :D.

Edit:
Please correct me if this is just stupid.


Yeah, yeah. I'm gonna modify that, so that it takes 5 random characters from the string :D. But, yeah that would be a feasible way to crack it.

Edit: That could be fixed easily enough by taking this line:

Code
$str1 = md5(microtime() * mktime());




And just shuffling all the characters before taking the 1st five like:

Code
$str2 = str_shuffle(md5(microtime() * mktime()));




Although I'm doubting that you could really do that. In theory it sounds good, but I doubt it'd work.




Edited by on 05-09-08 23:29
Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 05-09-08 23:59
Okie dokie, here is my captcha. It's simple, it could use some work but oh well I got some real projects to start working on. Not bad I guess for a total of 20 minutes of work, but my offer stands, if you can find a way to crack either one of them, I'll paypal you 100 bucks, but you've gotta explain and produce the code as to exactly how you did it so I can repeat it. Here the code:

Create image with random characters:
Code

<?php
session_start();
$str1 = str_shuffle(md5(microtime() * mktime()));
$str = substr($str1,0,5);
$captcha = imagecreatefrompng("./captcha.png");
$black = imagecolorallocate($captcha,0,0,0);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imageline($captcha,rand(50,200),rand(0,100),rand(50,200),rand(80,200),$black);
imageline($captcha,rand(50,250),rand(0,100),rand(0,200),rand(50,200),$black);
imageline($captcha,rand(70,150),rand(0,100),rand(50,200),rand(0,200),$black);
imageline($captcha,rand(20,150),rand(0,100),rand(20,150),rand(35,200),$black);
imageline($captcha,rand(80,200),rand(0,100),rand(50,200),rand(85,200),$black);
imageline($captcha,rand(0,50),rand(0,100),rand(0,200),rand(0,200),$black);
imagestring($captcha,rand(1,5),rand(0,100),rand(0,50),$str,$black);
$_SESSION['str'] = md5($str);
header("Content-type: image/png");
imagepng($captcha);
?>





Form/string validation:
Code

<?php
session_start();
echo <<<HTML
<html>
<head>
<title>Captcha</title>
</head>
<body>
<img src="captcha.php" border="0">
<form action="" method="post">
Enter the text from the image:<br><input type="text" name="code" />
<input type="submit" />
</form>
</body>
</html>
HTML;
if(!$_POST['code'])
die();
else
{
if(md5($_POST['code']) != $_SESSION['str'])
die("Error: Wrong code entered");
else
echo("Correct!");
}
?>





One thing I'd like to add though is a button to refresh only the image, not the whole page. Can anyone help me out there?


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 06-09-08 01:48
how about some ajax ?

btw
bin fast fertig Smile (die schwarzen striche nerven nur noch etwas)


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 06-09-08 02:14
sacman wrote:
how about some ajax ?

btw
bin fast fertig Smile (die schwarzen striche nerven nur noch etwas)


Wirklich?!? Nein...es kann nicht sein ShockSmile


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 06-09-08 09:35
slpctrl wrote:
money - paypal - $100


http://pastebin.ca/1195631

Code
<?php
/*
not the best way to do it but a very straightforward PoC.
even for this approach of 'ocr' there are still many optimizations
that could be done.. like skipping whiteblocks or doing some
preprocessing to see which rows have the most pixels and test
rows adjacent to that first...etc
*/

//note: you must have fopen wrappers w/ url support enabled for the following func to work
$captcha = imagecreatefrompng("http://slpctrl.freehostia.com/captcha.php");
imagepng($captcha, ".\\tmp.png");

//load all possible text combos
$kewlImages = array();

//different letters can compare equally.. most 'full' letters go first
$possibilities = "08bf74de123569ac";

//compares to bl's of images.. each letter - no matter the size - takes a fixed amount of iterations.
function block_compare($image, $startx, $starty, $compare) {
    $maxx = imagesx($image);
   $maxy = imagesy($image);
   $black = imagecolorallocate($image,0,0,0);
    for($y = $starty; ($y < $starty + 15 && $y < $maxy); $y++) {
      for($x = $startx; ($x < $startx + 10 && $x < $maxx); $x++) {
         $i = imagecolorat($image, $x, $y);
         $c = imagecolorat($compare, ($x-$startx), ($y-$starty));
         if($c == $black && $i != $black) return FALSE;
      }
   }
   if($y == $maxy || $x == $maxx) return FALSE;
   return TRUE;
}

//largest font to smallest
for($x = 5; $x >= 1; $x--) {
   for($y = 0; $y < strlen($possibilities); $y++) {
       $capture = imagecreatetruecolor(10, 15);
       imagefill($capture, 0, 0, imagecolorallocate($capture, 255, 255, 255));
       $black = imagecolorallocate($capture,0,0,0);
       /*cheap hack fix.. small fonts are better at being big fonts than
       big fonts.. need to shift index one pixel for smaller fonts*/
       if($x < 4)
          imagestring($capture, $x, 0, 0, $possibilities[$y], $black);
       else
          imagestring($capture, $x, 1, 0, $possibilities[$y], $black);
      array_push($kewlImages, $capture);
   }
}

$maxx = imagesx($captcha);
$maxy = imagesy($captcha);
$maxz = count($kewlImages);

$output = "";
$starty = 0;
$startz = 0;
$charfound = false;
$len = 0;

//we iterate through every (x,y) pixel coordinate and through each letter in our database
//and compare the image blocks to see if they are a match.. largest font sizes compared first
for($x = 0; $x < $maxx; $x++) {
   for($y = $starty; $y < $maxy; $y++) {
       $charfound = false;
      for($z = $startz; $z < $maxz; $z++) {
         if(block_compare($captcha, $x, $y, $kewlImages[$z])) {
             $output .= ($possibilities[$z%16]);
             //update limits
             $starty = $y;
             $maxy = $y+1;
             //update fonts
             $startz = ($z-($z%16));
             $maxz = $startz + 16;
             $len += 1;
            $charfound = true;
         }
         if($charfound) break;
      }
      if($charfound) break;
      if($len == 5) break;
   }
   if($len == 5) break;
}
echo $output . "<br>";

?>




shortdesc:

ascii md5 hash strings have 16 distinct characters.. the code you provided changed those characters in only 1 of 5 possible ways.. the code builds a database of all characters and all transformations and searches the image from left to right for possible characters.. this is a slow way to do it but it's very straightforward.. and the code I provided can be optimized a lot more. It works though.

Paypal: chinchilla@gmail.com

Thanks.

edit: smileys disabled :<

Edited by on 06-09-08 09:37
Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 06-09-08 14:50
damit my just cracks 20 % till now


Author

RE: CAPTCHA Questions


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 06-09-08 17:26
Chinchilla3k wrote:
slpctrl wrote:
money - paypal - $100


http://pastebin.ca/1195631

Code
<?php
/*
not the best way to do it but a very straightforward PoC.
even for this approach of 'ocr' there are still many optimizations
that could be done.. like skipping whiteblocks or doing some
preprocessing to see which rows have the most pixels and test
rows adjacent to that first...etc
*/

//note: you must have fopen wrappers w/ url support enabled for the following func to work
$captcha = imagecreatefrompng("http://slpctrl.freehostia.com/captcha.php");
imagepng($captcha, ".\\tmp.png");

//load all possible text combos
$kewlImages = array();

//different letters can compare equally.. most 'full' letters go first
$possibilities = "08bf74de123569ac";

//compares to bl's of images.. each letter - no matter the size - takes a fixed amount of iterations.
function block_compare($image, $startx, $starty, $compare) {
    $maxx = imagesx($image);
   $maxy = imagesy($image);
   $black = imagecolorallocate($image,0,0,0);
    for($y = $starty; ($y < $starty + 15 && $y < $maxy); $y++) {
      for($x = $startx; ($x < $startx + 10 && $x < $maxx); $x++) {
         $i = imagecolorat($image, $x, $y);
         $c = imagecolorat($compare, ($x-$startx), ($y-$starty));
         if($c == $black && $i != $black) return FALSE;
      }
   }
   if($y == $maxy || $x == $maxx) return FALSE;
   return TRUE;
}

//largest font to smallest
for($x = 5; $x >= 1; $x--) {
   for($y = 0; $y < strlen($possibilities); $y++) {
       $capture = imagecreatetruecolor(10, 15);
       imagefill($capture, 0, 0, imagecolorallocate($capture, 255, 255, 255));
       $black = imagecolorallocate($capture,0,0,0);
       /*cheap hack fix.. small fonts are better at being big fonts than
       big fonts.. need to shift index one pixel for smaller fonts*/
       if($x < 4)
          imagestring($capture, $x, 0, 0, $possibilities[$y], $black);
       else
          imagestring($capture, $x, 1, 0, $possibilities[$y], $black);
      array_push($kewlImages, $capture);
   }
}

$maxx = imagesx($captcha);
$maxy = imagesy($captcha);
$maxz = count($kewlImages);

$output = "";
$starty = 0;
$startz = 0;
$charfound = false;
$len = 0;

//we iterate through every (x,y) pixel coordinate and through each letter in our database
//and compare the image blocks to see if they are a match.. largest font sizes compared first
for($x = 0; $x < $maxx; $x++) {
   for($y = $starty; $y < $maxy; $y++) {
       $charfound = false;
      for($z = $startz; $z < $maxz; $z++) {
         if(block_compare($captcha, $x, $y, $kewlImages[$z])) {
             $output .= ($possibilities[$z%16]);
             //update limits
             $starty = $y;
             $maxy = $y+1;
             //update fonts
             $startz = ($z-($z%16));
             $maxz = $startz + 16;
             $len += 1;
            $charfound = true;
         }
         if($charfound) break;
      }
      if($charfound) break;
      if($len == 5) break;
   }
   if($len == 5) break;
}
echo $output . "<br>";

?>




shortdesc:

ascii md5 hash strings have 16 distinct characters.. the code you provided changed those characters in only 1 of 5 possible ways.. the code builds a database of all characters and all transformations and searches the image from left to right for possible characters.. this is a slow way to do it but it's very straightforward.. and the code I provided can be optimized a lot more. It works though.

Paypal: chinchilla@gmail.com

Thanks.

edit: smileys disabled :<


Half the time I was getting a fatal error, having taken more than 30 seconds to process, some of the characters your script returned was less than 5 characters (2-3), and I don't even know if the 5 digit characters are correct. My aim was for you to spoof the post value of the 5 digit character and bring the page back ( slpctrl.freehostia.com/code.php ) and have it echo 'Correct!' otherwise you may not even be returning the correct values. I'm not paypaling anything until someone can provide me with a script that spoofs the post value and returns %100 of the time (a fullproof crack) the text 'Correct!' Nice start though, I've learned a lot from this script.

And, no offense, but since you only posted a half done script, I changed 1 line. This one:

Code
$black = imagecolorallocate($captcha,0,0,0);



to:
Code
$color = imagecolorallocate($captcha,rand(0,50),rand(0,50),rand(0,50));




So now you're gonna have to redo it for the money. Next time don't submit half done code to me (although I do applaud the code you did, you weren't doing what I asked which is to actually crack it, not just return the characters which I'm not sure if they're right or not). So as of now your script doesn't work at all.




Edited by on 06-09-08 17:51
Page 2 of 7 < 1 2 3 4 5 > >>