ch1zra Posted May 24, 2009 Report Share Posted May 24, 2009 elem, imam ovo : $cxn=@mysql_connect("$host","$user","$pass") or die ($diemsg); @mysql_select_db("$dbname",$cxn); sve je jelda definisano, ali neki lik me je iscimao, i kao baci oko na ovo : http://ch1zra.com/mirc/index.php?display=S...t+all+1,2,3,4-- i tu izlista neke sitne pizdarijice (nisam se nikad interesovao oko injectiona, pa ne znam sta tacno izlistava, kontam da je broj kolona u datoj tabeli, and so on). elem, ja koliko sam uspeo da izgooglam, @mysql_connect i @mysql_select_db bi trebalo da resi taj problem, ali avaj.. nije :P dakle, jel imate ideju neku sta da radim ? :) nije da drzim neke bitne podatke i tim tabelama, al svejedno, zelim da ne moze niko da mi madjija tu. Quote Ko je nub ne budi mu drug. I mean you harm. Link to comment Share on other sites More sharing options...
dzontra.volta Posted May 24, 2009 Report Share Posted May 24, 2009 http://www.phearless.org/i4/TINY_phile_abo..._injections.txt http://www.phearless.org/i1/SQL_Injection.txt (Ovaj drugi je pisao de1, tako da ti on moze biti od vrle pomoci :]) Quote Link to comment Share on other sites More sharing options...
dvnityCker Posted May 24, 2009 Report Share Posted May 24, 2009 svaki upit u bazu ciji su delovi user-generated moras da provlacis kroz f-jy mysql_real_escape_string da bi se osigurao od haka. Ta funkcija je sigurna zastita od zloupotrebe. Mysql injection nastaje kada se radi neociscen upit u bazu. Recimo da imas kod kojim vrsis selekciju na osnovu nekog korisnickog odabira: $id = $_GET['id'] $result = mysql_query("SELECT * FROM admin WHERE id = $id"); ovaj upit je nesiguran zato sto ja umesto id-a u GET mogu da stavim sledeci kod recimo : 1; DROP TABLE admin i da se tebi izvrsi sledeci query: $result = mysql_query("SELECT * FROM admin WHERE id =1; DROP TABLE admin"); Quote The people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger. It works the same way in any country. Link to comment Share on other sites More sharing options...
ch1zra Posted May 24, 2009 Author Report Share Posted May 24, 2009 (edited) ok... i dalje me nesto jebucka :D ako moze mali heads up samo, gde i kako da ubacim escape ? $diemsg = "An error occurred while trying to retrieve data. Please try again later."; $cxn=@mysql_connect("$host","$user","$pass") or die ($diemsg); @mysql_select_db("$dbname",$cxn); $SnippetID = $_GET['SnippetID']; if (isset($SnippetID)) { $query = "select * from snippets where id = " . $SnippetID; $result = mysql_query($query) or die ("Can't find requested snippet."); while ($row = mysql_fetch_assoc($result)) { extract($row); echo "<div class=\"top\">"; echo "<div align=\"right\" style=\"color: #000000\">..:: \$snippets >> " . $snipname . "</div>"; $cnt = str_replace(" />",">",html_entity_decode($description, ENT_QUOTES)); echo "<div class=\"down\">"; echo $cnt; echo "<br><br>"; echo "<form name=\"snippet\" action=\"none\"><textarea name=\"snippet\" readonly style=\"color:#000000;background-color:#CCCCCC;\" onClick=\"java script:this.form.snippet.focus();this.form.snippet.select();\" cols=\"70\" rows=\"10\">" . $snip . "</textarea></form>"; echo "<hr width=\"600\"><div align=\"right\"><a href=\"index.php?display=Snippets\">Back to all \$snippets</a></div></div></div>"; } } //edit malo seljacka varijanta, al uspeo sam nesto da odradim.. ubacio sam : if (isset($SnippetID)) { if (!ctype_alnum($SnippetID)) { die("bad user input, gtfo!"); } Edited May 24, 2009 by ch1zra Quote Ko je nub ne budi mu drug. I mean you harm. Link to comment Share on other sites More sharing options...
dzontra.volta Posted May 24, 2009 Report Share Posted May 24, 2009 To bi trebalo da je to. Quote Link to comment Share on other sites More sharing options...
dvnityCker Posted May 24, 2009 Report Share Posted May 24, 2009 umesto: $SnippetID = $_GET['SnippetID']; ubaci: $SnippetID = mysql_real_escape_string($_GET['SnippetID']); Quote The people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger. It works the same way in any country. Link to comment Share on other sites More sharing options...
ch1zra Posted May 24, 2009 Author Report Share Posted May 24, 2009 blagodarim :) Quote Ko je nub ne budi mu drug. I mean you harm. Link to comment Share on other sites More sharing options...
Trooper Posted May 24, 2009 Report Share Posted May 24, 2009 also, nacin na koji ovo zapravo treba raditi: http://dev.mysql.com/tech-resources/articl...statements.html Quote Link to comment Share on other sites More sharing options...
dvnityCker Posted May 25, 2009 Report Share Posted May 25, 2009 ^ slazem se, ali dosta (besplatnih) hostova nema novi mysql, ili nema ukljucen mysqli Quote The people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger. It works the same way in any country. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.