Mecanik Posted May 9, 2013 Report Share Posted May 9, 2013 (edited) Target: http://istchall.uv.ro/Pentru cei care stiu XSS. Level: Hard.Reguli: Poza cu XSS, PM cu sintaxa.Cei care rezolva primesc Like.Solvers:TheTimeSweby Edited May 11, 2013 by Mecanik ImageBam e cacat. Quote Link to comment Share on other sites More sharing options...
sensi Posted May 9, 2013 Report Share Posted May 9, 2013 Un hint ceva ?! Quote Link to comment Share on other sites More sharing options...
Mecanik Posted May 9, 2013 Author Report Share Posted May 9, 2013 No hint! lol Quote Link to comment Share on other sites More sharing options...
Zatarra Posted May 9, 2013 Report Share Posted May 9, 2013 Hai sa iti dau eu un hint. Atat timp cat tu ai repuatie zero, poti sa tot oferi tu reputatie altora deoarece nu vor primi nimic. Got it? Quote Link to comment Share on other sites More sharing options...
TheTime Posted May 10, 2013 Report Share Posted May 10, 2013 Honeypot pentru vectori xss? Corecteaza-ma, te rog, daca ma insel. Quote Link to comment Share on other sites More sharing options...
Mecanik Posted May 10, 2013 Author Report Share Posted May 10, 2013 Gresit,este un filtru XSS custom creat de mine. Doar cu un vector special,scris custom poti trece de el...Daca chiar vreti,postez si functia sa va puteti orienta...Hint: este destul de saritor in ochi,doar cand introduci de exemplu: ""dupa filtru: \"\"Mai mult de atat,nu va pot ajuta doar am scris acolo [Hard]. Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 10, 2013 Report Share Posted May 10, 2013 Gresit,este un filtru XSS custom creat de mine. Doar cu un vector special,scris custom poti trece de el...Daca chiar vreti,postez si functia sa va puteti orienta...Hint: este destul de saritor in ochi,doar cand introduci de exemplu: ""dupa filtru: \"\"Mai mult de atat,nu va pot ajuta doar am scris acolo [Hard].Sa mori tu infipt in spada ca e o functie custom facuta de tine... Pentru ca mie mi se pare htmlentities(mysql_escape_string());Site-ul meu, folosind htmlentities(mysql_escape_string());http://tryingharder.tk/?stf=%3C%3E%27%22%26%2F%5CSi site-ul tau:http://istchall.uv.ro/index.php?sex=%3C%3E%27%22%26%2F%5CVezi vreo diferenta? Quote Link to comment Share on other sites More sharing options...
gafi Posted May 10, 2013 Report Share Posted May 10, 2013 Sa mori tu infipt in spada ca e o functie custom facuta de tine... Pentru ca mie mi se pare htmlentities(mysql_escape_string());Site-ul meu, folosind htmlentities(mysql_escape_string());http://tryingharder.tk/?stf=%3C%3E%27%22%26%2F%5CSi site-ul tau:http://istchall.uv.ro/index.php?sex=%3C%3E%27%22%26%2F%5CVezi vreo diferenta?Ac. lucru am vrut si eu sa-l zic, este htmlentities(mysql_escape_string()); Dar poate ne inselam. Vrei sa pui functia custom te rog? Sunt curios! Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 10, 2013 Report Share Posted May 10, 2013 Apropo, imi place ca nu ai postat challenge-ul pe isecenter, dar l-ai postat aici. Nu vrei sa furi vectori si de la aia 2 - 3 membri ai tai?Propun BAN. Quote Link to comment Share on other sites More sharing options...
Mecanik Posted May 10, 2013 Author Report Share Posted May 10, 2013 @Sweby: de ce trebuie sa fii idiot? de ce te crezi ca stii tot ?Poftim functia mai jos:function xss_clean($data){ // Creat de Mecanik pentru IST. Daca scoti textul asta,esti un lame,lake,si un noob. // Scoate &entity; $data = str_replace(array('&','<','>'), array('&','<','>'), $data); $data = preg_replace('/(*\w+)[\x00-\x20]+;/u', '$1;', $data); $data = preg_replace('/(*[0-9A-F]+);*/iu', '$1;', $data); //$data = html_entity_decode($data, ENT_COMPAT, 'UTF-8'); // Scoate orice atribut incepand cu "on" sau xmlns $data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data); // Scoate javascript: si vbscript: orice protocol $data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data); // Prostia din IE: <span style="width: expression(alert('Ping!'));"></span> $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*[^>]*+>#iu', '$1>', $data); // Mai scoatem ceva elemente $data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data); do { // scoatem tag-urile ce nu le vrem deloc... $old_data = $data; $data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data); } while ($old_data !== $data); // Si suntem gata =D return $data;}e chemata asa: $xss = xss_clean($_GET['sex']);Nu ma feresc sa o postez,ca mai am 2 filtre si mai calumea,daca le puneam toate era dezastru p.s sweby: sa mori tu infipt in pula. Quote Link to comment Share on other sites More sharing options...
sensi Posted May 10, 2013 Report Share Posted May 10, 2013 (edited) @TheTime, esti 100% sigur ?@Zatarra, nu toti fac ceva pentru rasplata, poate unii vor sa invete/exerseze .@Sweby, daca nu poti face challenge-ul, nu trebuie sa te apuci sa iei omu' la pula.p.s: in 30 min il fac.Un filtru dasta mi-a vandut si mie Edited May 10, 2013 by sensi Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 10, 2013 Report Share Posted May 10, 2013 (edited) @TheTime, esti 100% sigur ?@Zatarra, nu toti fac ceva pentru rasplata, poate unii vor sa invete/exerseze .@Sweby, daca nu poti face challenge-ul, nu trebuie sa te apuci sa iei omu' la pula.p.s: in 30 min il fac.Un filtru dasta mi-a vandut si mie Daca ai cumparat asa ceva, esti prost.@Sweby: de ce trebuie sa fii idiot? de ce te crezi ca stii tot ?Poftim functia mai jos:function xss_clean($data){ // Creat de Mecanik pentru IST. Daca scoti textul asta,esti un lame,lake,si un noob. // Scoate &entity; $data = str_replace(array('&','<','>'), array('&','<','>'), $data); $data = preg_replace('/(*\w+)[\x00-\x20]+;/u', '$1;', $data); $data = preg_replace('/(*[0-9A-F]+);*/iu', '$1;', $data); //$data = html_entity_decode($data, ENT_COMPAT, 'UTF-8'); // Scoate orice atribut incepand cu "on" sau xmlns $data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data); // Scoate javascript: si vbscript: orice protocol $data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data); // Prostia din IE: <span style="width: expression(alert('Ping!'));"></span> $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*[^>]*+>#iu', '$1>', $data); // Mai scoatem ceva elemente $data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data); do { // scoatem tag-urile ce nu le vrem deloc... $old_data = $data; $data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data); } while ($old_data !== $data); // Si suntem gata =D return $data;}e chemata asa: $xss = xss_clean($_GET['sex']);Nu ma feresc sa o postez,ca mai am 2 filtre si mai calumea,daca le puneam toate era dezastru p.s sweby: sa mori tu infipt in pula.Mincinosu roade pula. 1. la mana functia asta nu face escape la " sau '.2. la mana, e luata de pe net: filter - XSS filtering function in PHP - Stack Overflow3. la mana nu e aceeasi functie pe care o folosesti pe site.Site-ul meu cu functia taSite-ul tau care zici ca foloseste tot functia ta.Muie. Edited May 10, 2013 by Sweby Quote Link to comment Share on other sites More sharing options...
Mecanik Posted May 10, 2013 Author Report Share Posted May 10, 2013 Esti idiot,ti-am mai zis-o sus:1. la mana,functia e editata,deci e custom,il consider made by me.2. la mana,e acelasi ca si pe site,ca de acolo am dat paste.3. la mana,nu fii smecher,si cheama functia calumea Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 10, 2013 Report Share Posted May 10, 2013 Cum ai zis tu ca chemi functia:$xss = xss_clean($_GET['sex']);Cum am chemat eu functia:$xss = xss_clean($_GET['stf']);Am schimbat numele inputului, ma scuzi ca nu-s virgin ca tine. Poti sa chemi cum ai vrea tu functia, tot nu face escape la stringuri. Quote Link to comment Share on other sites More sharing options...
Mecanik Posted May 10, 2013 Author Report Share Posted May 10, 2013 (edited) Da cum sa faca ma escape,cand el este preg_replace,tu nu vezi ce e acolo?Si nu e acelasi lucru, daca il chemi de 2 ori,e si mai bine, de exemplu: $xss = xss_clean($_GET['stf']);print "". xss_clean(trim($_GET['stf'])). "";sau si mai bine: $xsss = xss_clean(trim(htmlspecialchars($_GET['stf'])));print $xsss; la PRINT conteaza! Edited May 10, 2013 by Mecanik Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 10, 2013 Report Share Posted May 10, 2013 Da cum sa faca ma escape,cand el este preg_replace,tu nu vezi ce e acolo?Si nu e acelasi lucru, daca il chemi de 2 ori,e si mai bine, de exemplu: $xss = xss_clean($_GET['stf']);print "". xss_clean(trim($_GET['stf'])). "";sau si mai bine: $xsss = xss_clean(trim(htmlspecialchars($_GET['stf'])));print $xsss; la PRINT conteaza!Deja imi dau seama cat php stii... Apelezi functia trim degeaba si la print concatenezi nimic cu apelurile alea, era necesar?La al 2-lea exemplu folosesti htmlspecialchars si deja is 2 functii care filtreaza request-ul. Avand in vedere ca pe pagina cu challenge-ul, valoarea se afiseaza direct pe pagina si nu intr-un tag, e cam imposibil sa faci bypass.Dar deja deviem de la subiect, n-am vrut sa arat decat ca pe pagina cu challenge-ul nu folosesti filtrele ce le-ai zis tu. Pa. 1 Quote Link to comment Share on other sites More sharing options...
Sega Posted May 10, 2013 Report Share Posted May 10, 2013 @gm_dizzy: Daca tot ai postat challenge-ul, presupun ca stii sintaxa corecta de bypass. Te rog sa ne uimesti cu sintaxa. Quote Link to comment Share on other sites More sharing options...
TheTime Posted May 10, 2013 Report Share Posted May 10, 2013 http://s10.postimg.org/7lh6f00op/image.pngPrimesti PM cu sintaxa doar dupa ce faci publica sintaxa ta. Daca zici ca filtrul tau este "inspirat" de prin alte parti, nu vreau sa te ajut sa-i faci bypass. Daca vrei, apelam la un admin ca sa facem "schimb de sintaxe".Cheers! Quote Link to comment Share on other sites More sharing options...
gafi Posted May 10, 2013 Report Share Posted May 10, 2013 http://s10.postimg.org/7lh6f00op/image.pngPrimesti PM cu sintaxa doar dupa ce faci publica sintaxa ta. Daca zici ca filtrul tau este "inspirat" de prin alte parti, nu vreau sa te ajut sa-i faci bypass. Daca vrei, apelam la un admin ca sa facem "schimb de sintaxe".Cheers! Sunt curios ce sintaxa ai folosit. Sunt incepator cu xss dar lucrez din greu , daca esti dragut sa-mi dai PM cu sintaxa ta, mi-ar fi de mare ajutor la invatat.Bafta! Quote Link to comment Share on other sites More sharing options...
Mecanik Posted May 10, 2013 Author Report Share Posted May 10, 2013 ce imi explica mie Sweby...ca nu stie ce face trim ... PHP: trim - Manualuite ce contine pagina...ca sa clarificam treaba :$xss = xss_clean($_GET['sex']); if(isset($_GET['sex'])) { echo '<div align="center"><form method="GET" action="index.php">De cate ori faci sex pe an?<br ><input type="text" name="sex" size="25" /><input type="submit" /></form>Tu faci de: '.$xss.' <hr />Challenge creat de Mecanik.</div>'; }elseif(!isset($_GET['sex'])) { echo '<div align="center"><form method="GET" action="index.php">De cate ori faci sex pe an?<br ><input type="text" name="sex" size="25" /><input type="submit" /></form>Tu faci de: '.$xss.' <hr />Challenge creat de Mecanik.</div>'; }ob_flush();si scuze TheTime,dar eu nu imi fac public vectorul...ai reusit,bravo,asta inseamna ca se poate,te trec la solvers.l.e: scuze gafi,dar nu pot,este un challenge mai tarziu fac unul foarte usor,pentru incepatori. Quote Link to comment Share on other sites More sharing options...
SilenTx0 Posted May 10, 2013 Report Share Posted May 10, 2013 Ai si tu un vector facut de tine 0,5 day la fel la RUTE ? sau de ce nu vrei sa-l faci public? Quote Link to comment Share on other sites More sharing options...
Mecanik Posted May 10, 2013 Author Report Share Posted May 10, 2013 Cum sa-l fac public frate este un challenge... uite Time si-a facut,si a reusit.Cheers! Quote Link to comment Share on other sites More sharing options...
SilenTx0 Posted May 10, 2013 Report Share Posted May 10, 2013 pai nu zic neaparat acum.dupa ce se termina challange-ul:) Quote Link to comment Share on other sites More sharing options...
sensi Posted May 10, 2013 Report Share Posted May 10, 2013 @The Time, ce versiune de Chrome folosesti? Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 10, 2013 Report Share Posted May 10, 2013 ce imi explica mie Sweby...ca nu stie ce face trim ... PHP: trim - Manualuite ce contine pagina...ca sa clarificam treaba :$xss = xss_clean($_GET['sex']); if(isset($_GET['sex'])) { echo '<div align="center"><form method="GET" action="https://rstforums.com/forum/forum.php">De cate ori faci sex pe an?<br ><input type="text" name="sex" size="25" /><input type="submit" /></form>Tu faci de: '.$xss.' <hr />Challenge creat de Mecanik.</div>'; }elseif(!isset($_GET['sex'])) { echo '<div align="center"><form method="GET" action="https://rstforums.com/forum/forum.php">De cate ori faci sex pe an?<br ><input type="text" name="sex" size="25" /><input type="submit" /></form>Tu faci de: '.$xss.' <hr />Challenge creat de Mecanik.</div>'; }ob_flush();si scuze TheTime,dar eu nu imi fac public vectorul...ai reusit,bravo,asta inseamna ca se poate,te trec la solvers.Da frate iti explic, pentru ca tu l-ai apelat:print "". xss_clean(trim($_GET['stf'])). "";si asa nu face nimic, e apelata degeaba functia trim(). Ca sa fie cat de cat folositoare trebuie sa ii specifici si ce caractere sa stearga:print "". xss_clean(trim($_GET['stf'][COLOR="#FF0000"], "<>"[/COLOR])). "";Cat despre filtru, l-ai editat acum, cine a incercat inainte, a observat ca "<>&" erau transformate in entities si acum nu mai sunt... Pun pariu ca tu nu poti sa treci de xss_clean() . Quote Link to comment Share on other sites More sharing options...