EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff

Training Missions

Read Me First
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Captcha Cracking
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom
/dev/extra

Knowledge Bank

Discussion Forums
Exploit Database New
PasteBin New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Downloads
Tools

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Pimp Us Out!

Review enigmagroup.org on alexa.com

Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.

Enigma Group

Enigma Group

Enigma Group

Enigma Group

 

Affiliates



The Urinal

hackhound.org

suck-o.com

hack.org.za

flyninja.net

 

Enigma Group's Articles



Return to Category Selection

Second Order Code Injection Explained. - Submitted By: t3hmadhatt3r 2009-05-19 21:00:40
Hello everyone. In this tutorial I will explain the basic concept of second order code injection.

Ok...lets get started on the basic idea behind second order injection. Second order code injection includes injecting code into a part of the application where it will be processed later. Second order code injection can involve any kind of code injection but, is mostly XSS and sometimes, SQL.

Alright now I'll give you a few examples. We will start with XSS and then go to SQL. Second order XSS usually involves injecting code into server logs, my details page, or messages to the admin. Injecting into the logs is pretty simple and very effective as long as the admin checks the logs periodically. Here are some examples.

Using HTTP
Code:

GET/ </textarea><script>alert("xss")</script>

Injecting into USER Agent.
Code:

user-agent=</textarea><script>alert("xss")</script>

Note: I use burp proxy to change the request and user agent and you can do the same. Just download the Burp Suite from http://portswigger.net/suite/

Both of these end the <textarea> tag and display a alert. Pretty simple but, as you all know you could steal cookies or perform XSRF and make yourself a admin account! The danger of log injection is huge because even if the admin is careful about the links he presses he will still be XSSed when he views the logs.Another cool thing you could do to hide the attack is use an iframe to hide the scripts all together. So that basically covers Log Injection (HTTP Logs) but, you could also try injecting scripts into ftp logs, telnet logs, smtp logs etc. If the logs are viewed in HTML. Now onto injecting into your "my details" page. Usually no one would care if you could XSS your "my details" page because only you can see it but, you could inject some code into your page and send a message to the staff / admins telling them your my details page is messed up and ask them if they could take a look. That way they will view your profile with there admin/moderator account and give you their cookies, priviledges to make new admin accounts, or anything else you needed.... Now I think everyone knows that if a PM system has XSS anyone could own the site so I wont go into that because its essentially the same thing as the other examples.

Now onto SQL. SQL is usually allot harder to find because most people strip the meta-characters needed to perform a attack but, I show you one example anyway. Lets say this site has a self register function and the site comments out all dangerous characters like single quotes, double quotes, and semicolons when received by a user (The filter is an input filter) but, not the output. One attack we could do is registering an account called admin'-- and passwordassword. Then go to the change password feature and change our pass. This will also change the password of the admin because the '-- will stop the query making the username look like admin... Not admin'--. The SQL Query would look something like this.

Code:

UPDATE PASSWORD WHERE USERNAME = 'admin'--' AND PASSWORD='password';

So our username admin'-- is ending the QUERY making the username look like admin and only admin...This allows us to change the admins password.. Cool huh?

These are just a few of the things you can do with Second order injection. Anything that takes data and displays it at a later time could be vulnerable.

Well that is second order code injection explained simply. I will explain some things that could be vulnerable more in depth in later tutorials. Please leave comments and suggestions .

Return to Category Selection
Comment By: jalal77 2011-08-02 15:27:12
cool tuth but if u expaln with a example then it can be more nice.any way thnkx keep it up

If you wish to submit a comment, you must be a registered member and logged in.

Login or Register.



Return to Category Selection

 

Who Visited EnigmaGroup Today?

1579 Guests, 269 Users (180 Spiders)
Klosse, Effomeidonize, trueorfalse, Distorted, blackknight911, JohnMalkovitzch, TheHarrisonW, Rex_Mundi, strudels, Obop, hkevin, whoami, ellisp, Hessesian, Vreality2007, whisperer, advenlydent, zach, ddxc, suetekh, Vengeance987, m0rt, 2345, electro-technic, riesenjoe, Bumpadjuppy, IvanDimitriev, nmobin27, RomeoG, timetrust, 2142, 3ntr0py, BillTuer, advilapyday, lotato, lonely.connection, CloverCipher, vnd, aurena, rospark, valy1177, Blavatsky, learning, st3alth, Partisan, hackaday, K0gller, fitz, DrOptix, Jayjay, psychomarine, Vspectrum, San Marino, TinCardinal, brunoriversyhn, code-g, yshiau, Psiber_Syn, Seasharp, obencefoozy, SlayingDragons, Link-, tinuigimeni, jasonbourne, Fred, GothicLogic, somebody777, Meonkzt, CJ_Omaha, jearrorne, cls777, unsugsNashy, Balksnuntails, Sir D. Naut, batsbargy, Rik, Macabre, Nightraven, Iccyx, Repuhlsive, vipervince2002, Janomatrix, lol, veceattainc, techno, Exclaw, limited, Nikhil, evjfvir967nj, Mod777, dark_void, nermtode, Tjm, bjy1997, hecky, saraf, elprof, damoniceht, trik, jordan86, SnoopSky, dan_movie, OnetInsolefon, darkfire1515, seojlhmyrhwh, Thoplehap, MaxMeier, 1028rajeev, Abhinav2107, autotuneuser, alexelixir, Tauya, Jozinbrejl, kernel_mod, quolc, anandoump, vladavlada, Taicadine, AnnaNoult, GreenTiger, baripadatimes, Ewing, Blackbeard, thepuppeteer, BON-SELE, hak4r, Unotohumsmush, NIGHTWOLF, m4f10, avacraft, becool, thecoder, n01se, alpha1, saki, ObesseJew, ActictGlync, sajan, unicornrainbow, Domihoolbob, matt.14, max66, SnowFury, Spud101, myfabregas, Ausome1, kajman121, Frudopvia, ideveloper6, OLOLO, Bugshuppy, lamb, VagWirura, LialiTiTviors, Ordeptpen, scifics, Pozycj-Z21, Gkjt, interPuscruse, aaftab, TheCheeseDemon, blackcyxx21, jollyjimbo, N4g4c3N, rineDriekly, Rap70r, Xargos, flarornEral, ovetz13, sonu sahu, Breezy, emitleBen, Hackpad, JWTSR, nicyun, kaizo, itevainee, luke460, AverageJoe, zeratu92, litbk, Mr.Pickle, mannavard1611, LoopyLion, NexusVos, mtroscheck, burberrybagsjr, nikedunksxm, xordux, jeho, Lonewolf034, Dragonite, nhorton, Reloaded, Odile, Kaptain_k1rk, Teefelltugh, grizzly, posthuman01, jakesboy2, pwnpwnlolz, Sabo, Lakhoamnmek, Røgue, dot_Cipher, mori, snickerless1, cart1m, Xendz, KELATALFTUS, hubris, Afrika, welepocourl, carpinteyrofbt, ReottphoffBom, Reahastegah, pumashoesld, pdanielt, dmac006, DnA-Ender, Red Fox, couptupleakb, ryanjcrook, iMaxx, sh3llcod3, TimHortons, EmilaHapsaums, Feld Grau, burgeoningneophyte, Maroonhat, CookieAu, tinkansinar, Mitodina, timberlandoutletlufc, zsefvy, guccioutletox, AlexDiru, AbercrombieFitchhl, Ryuske, r0z4, slchill, kalak55, Ph4Kt480ii, beefarn, Jigoku, WrossyJes, pollolololo, ZepSung, Fragility, jell0, C9019, Othrguy, Noticon, KIKNWING, llasarus, mdubz, leah027, iellswo, MAZI_, Estilaamoli, subtentar, Trollorful, no, nas0151, Traybo, howisthechicken, thethird3y3, Somethingclever, marplusz
 
Enigma Group