Jump to content
shaggi

[HARD] The life of a beginner php programmer

Recommended Posts

Posted (edited)

o4evC4P.png

Solutii doar pe PM!!!

Nu mai postati hinturi!!

Solvers:

- Gecko

- GarryOne

- Ganav

-

-

Challange closed

Indicii din foto: ip-ul serverului, faptul ca era un backup facut al scriptului, inainte de a ii aduce modificarile fisierului secret, si a crea users

Obiectivul care trebuia atins: continutul fisierului news_1337_index.txt din folderul userului admin avea nevoie ca sa fii logat ca admin, pentru a-l vedea, acolo se afla solutia:

root@freecamshow:/var/www/users/admin# cat news_1337_index.txt 
I'm the programmer who made this fucking vulnerable script to make your mind to blow up, please do not post the solution on forum




lopdspfpfsjkfskkfkskllaldkjfhahgad


Muie,
shaggi!


root@freecamshow:/var/www/users/admin#


Solutie 1: crearea unui user cu numele admin, deoarece sistemul permitea acest lucru, si vizualizarea fisierului,

register.php


<?php
function checklogin($user,$md5pass) {
$loginfile = file("users/users");
$txttchk = md5($user."lololo".$md5pass)."\n";
if(in_array($txttchk,$loginfile)){

return true;
}
return false;

}


.................................

if(checklogin($_POST['user'],md5($_POST['passwd']))){ die("account already exist");
}else{
file_put_contents($usersfile,md5($_POST['user']."lololo".md5($_POST['passwd']))."\n",FILE_APPEND);
die("registered succesfully, go to index.php");

}
..............................
?>

Solutie 2: Bypass la verificarea userului, folosind *, deoarece sistemul permitea acest lucru, luandu-si path-ul catre fisier, folosindu-se de glob


<?php
.................

if(isset($_GET['id']) && isset($_GET['user'])){
$_GET['user'] = str_replace(".","",$_GET['user']);
$_GET['user'] = str_replace("/","",$_GET['user']);
if($_GET['user'] == "admin" ) {
if(checklogin($_COOKIE['user'],$_COOKIE['pass']) && $_COOKIE['user'] == "admin"){
echo "access granted<br>";
}else{
die("access denied");
}
}
echo @file_get_contents(glob("./users/".$_GET['user']."/news_".$_GET['id']."_index.txt")[0]);

}}


.................

?>

Source code Download: GirlShare - Download first_backup.tar.gz

Felicitari tuturor celor care au rezolvat challange-ul!!

Edited by shaggi

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...