shaggi Posted November 2, 2014 Report Posted November 2, 2014 (edited) 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 usersObiectivul 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 forumlopdspfpfsjkfskkfkskllaldkjfhahgadMuie,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<?phpfunction 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.gzFelicitari tuturor celor care au rezolvat challange-ul!! Edited November 23, 2014 by shaggi Quote
blech Posted November 2, 2014 Report Posted November 2, 2014 am incercat...m-am uitat prin fisiere dar din pacate nu stiu PHP Quote
shaggi Posted November 23, 2014 Author Report Posted November 23, 2014 Challange closed!!https://rstforums.com/forum/91540-hard-life-beginner-php-programmer.rst#post583123 Quote