ThreatFire Research Blog Home
 
 
« Oak Ridge visitor db compromised
Merriam Webster w00t w00t »

Tool for shellcode analysis

Here’s some favorite c that I use to reverse engineer shellcode that I collect from malicious files, malicious web sites and attacking network traffic:

unsigned char shellcode[] = “”;

void main() {
void (*c)();
printf(”Shellcode it is!\n”);
*(int*)&c = shellcode;
c();
}

Basically, the code creates a buffer that stores your collected shellcode, creates a pointer to a void function empty of instruction, points the function to the beginning of the buffer and transfers control to it, just like an attacker’s exploit. Drop the hex into the array as a c-style string, compile it, and toss it into Olly for stepping and analysis!
We’ll look at a current example from a site in the wild in an upcoming post.

This entry was posted on Monday, December 17th, 2007 at 4:59 pm and is filed under Exploit, Reversing, Shellcode. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Tool for shellcode analysis”

  1. Ô¿Ô says:
    January 8, 2009 at 3:28 pm

    Hello Threatfire,

    Wanted to know if anyone could tell me what this shellcode does. Just curious as to what someone sent.

    char peer0_0[] = {

    0×48, 0×54, 0×54, 0×50, 0×2f, 0×31, 0×2e, 0×30,

    0×20, 0×32, 0×30, 0×30, 0×20, 0×4f, 0×4b, 0×0d,

    0×0a, 0×53, 0×65, 0×72, 0×76, 0×65, 0×72, 0×3a,

    0×20, 0×41, 0×70, 0×61, 0×63, 0×68, 0×65, 0×0d,

    0×0a, 0×45, 0×54, 0×61, 0×67, 0×3a, 0×20, 0×22,

    0×32, 0×37, 0×32, 0×61, 0×35, 0×32, 0×2d, 0×31,

    0×32, 0×62, 0×61, 0×2d, 0×37, 0×36, 0×31, 0×38,

    0×38, 0×66, 0×30, 0×30, 0×22, 0×0d, 0×0a, 0×41,

    0×63, 0×63, 0×65, 0×70, 0×74, 0×2d, 0×52, 0×61,

    0×6e, 0×67, 0×65, 0×73, 0×3a, 0×20, 0×62, 0×79,

    0×74, 0×65, 0×73, 0×0d, 0×0a, 0×43, 0×6f, 0×6e,

    0×74, 0×65, 0×6e, 0×74, 0×2d, 0×4c, 0×65, 0×6e,

    0×67, 0×74, 0×68, 0×3a, 0×20, 0×34, 0×37, 0×39,

    0×34, 0×0d, 0×0a, 0×43, 0×61, 0×63, 0×68, 0×65,

    0×2d, 0×43, 0×6f, 0×6e, 0×74, 0×72, 0×6f, 0×6c,

    0×3a, 0×20, 0×6d, 0×61, 0×78, 0×2d, 0×61, 0×67,

    0×65, 0×3d, 0×38, 0×36, 0×34, 0×30, 0×30, 0×0d,

    0×0a, 0×43, 0×6f, 0×6e, 0×74, 0×65, 0×6e, 0×74,

    0×2d, 0×54, 0×79, 0×70, 0×65, 0×3a, 0×20, 0×69,

    0×6d, 0×61, 0×67, 0×65, 0×2f, 0×6a, 0×70, 0×65,

    0×67, 0×0d, 0×0a, 0×41, 0×67, 0×65, 0×3a, 0×20,

    0×31, 0×32, 0×36, 0×30, 0×34, 0×0d, 0×0a, 0×44,

    0×61, 0×74, 0×65, 0×3a, 0×20, 0×54, 0×75, 0×65,

    0×2c, 0×20, 0×33, 0×30, 0×20, 0×44, 0×65, 0×63,

    0×20, 0×32, 0×30, 0×30, 0×38, 0×20, 0×31, 0×38,

    0×3a, 0×31, 0×32, 0×3a, 0×33, 0×35, 0×20, 0×47,

    0×4d, 0×54, 0×0d, 0×0a, 0×4c, 0×61, 0×73, 0×74,

    0×2d, 0×4d, 0×6f, 0×64, 0×69, 0×66, 0×69, 0×65,

    0×64, 0×3a, 0×20, 0×4d, 0×6f, 0×6e, 0×2c, 0×20,

    0×31, 0×37, 0×20, 0×4d, 0×61, 0×72, 0×20, 0×32,

    0×30, 0×30, 0×38, 0×20, 0×31, 0×36, 0×3a, 0×32,

    0×35, 0×3a, 0×30, 0×30, 0×20, 0×47, 0×4d, 0×54,

    0×0d, 0×0a, 0×45, 0×78, 0×70, 0×69, 0×72, 0×65,

    0×73, 0×3a, 0×20, 0×57, 0×65, 0×64, 0×2c, 0×20,

    0×33, 0×31, 0×20, 0×44, 0×65, 0×63, 0×20, 0×32,

    0×30, 0×30, 0×38, 0×20, 0×31, 0×34, 0×3a, 0×34,

    0×32, 0×3a, 0×33, 0×31, 0×20, 0×47, 0×4d, 0×54,

    0×0d, 0×0a, 0×43, 0×6f, 0×6e, 0×6e, 0×65, 0×63,

    0×74, 0×69, 0×6f, 0×6e, 0×3a, 0×20, 0×63, 0×6c,

    0×6f, 0×73, 0×65, 0×0d, 0×0a, 0×0d, 0×0a, 0xff,

    0xd8, 0xff, 0xe0, 0×00, 0×10, 0×4a, 0×46, 0×49,

    0×46, 0×00, 0×01, 0×01, 0×01, 0×01, 0×2c, 0×01,

    0×2c, 0×00, 0×00, 0xff, 0xdb, 0×00, 0×43, 0×00,

    0×0b, 0×07, 0×08, 0×0a, 0×08, 0×07, 0×0b, 0×0a,

    0×09, 0×0a, 0×0c, 0×0c, 0×0b, 0×0d, 0×10, 0×1b,

    0×12, 0×10, 0×0f, 0×0f, 0×10, 0×21, 0×18, 0×19,

    0×14, 0×1b, 0×27, 0×23, 0×29, 0×29, 0×27, 0×23,

    0×26, 0×25, 0×2c, 0×31, 0×3f, 0×35, 0×2c, 0×2e,

    0×3b, 0×2f, 0×25, 0×26, 0×36, 0×4a, 0×37, 0×3b,

    0×41, 0×43, 0×46, 0×47, 0×46, 0×2a, 0×34, 0×4d,

    0×52, 0×4c, 0×44, 0×52, 0×3f, 0×45, 0×46, 0×43,

    0xff, 0xdb, 0×00, 0×43, 0×01, 0×0c, 0×0c, 0×0c,

    0×10, 0×0e, 0×10, 0×20, 0×12, 0×12, 0×20, 0×43,

    0×2d, 0×26, 0×2d, 0×43, 0×43, 0×43, 0×43, 0×43,

    0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43,

    0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43,

    0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43,

    0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43,

    0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43, 0×43,

    0×43, 0×43, 0×43, 0×43, 0×43, 0xff, 0xc0, 0×00,

    0×11, 0×08, 0×00, 0×96, 0×00, 0×6e, 0×03, 0×01,

    0×22, 0×00, 0×02, 0×11, 0×01, 0×03, 0×11, 0×01,

    0xff, 0xc4, 0×00, 0×1c, 0×00, 0×00, 0×03, 0×01,

    0×01, 0×01, 0×01, 0×01, 0×01, 0×00, 0×00, 0×00,

    0×00, 0×00, 0×00, 0×00, 0×00, 0×04, 0×05, 0×06,

    0×03, 0×00, 0×02, 0×07, 0×01, 0×08, 0xff, 0xc4,

    0×00, 0×3c, 0×10, 0×00, 0×02, 0×01, 0×03, 0×03,

    0×01, 0×05, 0×06, 0×04, 0×05, 0×02, 0×06, 0×03,

    0×00, 0×00, 0×00, 0×01, 0×02, 0×03, 0×00, 0×04,

    0×11, 0×05, 0×12, 0×21, 0×31, 0×06, 0×13, 0×22,

    0×41, 0×51, 0×14, 0×61, 0×71, 0×81, 0×91, 0xb1,

    0×07, 0×15, 0×32, 0xa1, 0×23, 0×42, 0×52, 0xc1,

    0xe1, 0×33, 0xd1, 0×24, 0×35, 0×43, 0×73, 0×82,

    0xf0, 0×53, 0×62, 0×72, 0xff, 0xc4, 0×00, 0×19,

    0×01, 0×00, 0×02, 0×03, 0×01, 0×00, 0×00, 0×00,

    0×00, 0×00, 0×00, 0×00, 0×00, 0×00, 0×00, 0×00,

    0×00, 0×03, 0×04, 0×01, 0×02, 0×05, 0×00, 0xff,

    0xc4, 0×00, 0×2c, 0×11, 0×00, 0×01, 0×04, 0×02,

    0×01, 0×02, 0×04, 0×05, 0×05, 0×01, 0×00, 0×00,

    0×00, 0×00, 0×00, 0×00, 0×01, 0×00, 0×02, 0×03,

    0×11, 0×12, 0×21, 0×31, 0×04, 0×13, 0×22, 0×41,

    0×71, 0xf0, 0×32, 0×51, 0×61, 0×81, 0xd1, 0×33,

    0×91, 0xa1, 0xb1, 0xe1, 0xf1, 0xff, 0xda, 0×00,

    0×0c, 0×03, 0×01, 0×00, 0×02, 0×11, 0×03, 0×11,

    0×00, 0×3f, 0×00, 0xfa, 0×1c, 0xf2, 0×18, 0×58,

    0×39, 0×39, 0×00, 0×79, 0×50, 0×2b, 0×36, 0×30,

    0×39, 0xe1, 0xb3, 0×45, 0xdf, 0×95, 0×31, 0×9c,

    0×67, 0xca, 0×97, 0xe3, 0×3c, 0×64, 0×8c, 0xf1,

    0×9f, 0×4a, 0×79, 0×80, 0×63, 0×69, 0×37, 0×9d,

    0xd2, 0×2a, 0×4b, 0xb0, 0xe1, 0xb1, 0×9f, 0×10,

    0xc7, 0×4a, 0xce, 0×3b, 0×8d, 0xac, 0×84, 0xe7,

    0xc3, 0xee, 0xa4, 0×5a, 0×06, 0xa1, 0×34, 0xd6,

    0×17, 0×06, 0xfd, 0xf7, 0×4f, 0×69, 0×2b, 0xa4,

    0xad, 0×80, 0×38, 0×5e, 0×7c, 0xbd, 0xd5, 0×9f,

    0×65, 0×35, 0×69, 0×75, 0×2b, 0×29, 0×9e, 0xed,

    0xb3, 0×24, 0×52, 0×12, 0×4e, 0×31, 0×84, 0×23,

    0×23, 0xf6, 0xcd, 0×5a, 0×9b, 0×4a, 0xce, 0×8d,

    0xe2, 0xcf, 0xc9, 0×51, 0xcb, 0×73, 0xbd, 0×58,

    0×0c, 0xf2, 0×7d, 0×2b, 0xa2, 0xb9, 0xd8, 0×41,

    0×39, 0xe3, 0xdd, 0×53, 0×5a, 0×4e, 0xb4, 0xab,

    0xa5, 0xb5, 0xf6, 0xa9, 0×74, 0xa8, 0×93, 0×4c,

    0xfd, 0xc8, 0×61, 0×8f, 0×00, 0×38, 0×00, 0×01,

    0xc9, 0xa3, 0×20, 0xd7, 0xf4, 0xb9, 0xd4, 0×32,

    0×5d, 0xa6, 0×37, 0xaa, 0×60, 0×82, 0×0e, 0×4f,

    0×4e, 0×31, 0×9a, 0×92, 0xd0, 0×02, 0xe3, 0×1c,

    0×80, 0xf0, 0×9b, 0xcb, 0×3e, 0xfc, 0xe3, 0×3c,

    0xfb, 0xab, 0×48, 0xee, 0xc2, 0×1e, 0×73, 0xd3,

    0xd2, 0xa2, 0xee, 0xf5, 0xd9, 0×2d, 0×74, 0xfb,

    0×71, 0xf9, 0×94, 0×53, 0×5c, 0×35, 0xd7, 0×89,

    0xd1, 0×30, 0×0c, 0×40, 0×90, 0×46, 0×08, 0xf2,

    0xe9, 0×4c, 0xee, 0×35, 0xcb, 0×1c, 0×93, 0×1e,

    0xa5, 0×12, 0×06, 0×08, 0×50, 0×6c, 0×24, 0×9c,

    0xf4, 0xf8, 0xe7, 0xfb, 0×54, 0×00, 0×1c, 0×14,

    0×98, 0xa4, 0×6e, 0xd3, 0xc7, 0×9b, 0×77, 0xd7,

    0×3d, 0×2b, 0×54, 0xbc, 0×0a, 0×0e, 0×41, 0xe4,

    0×63, 0xa5, 0×4f, 0×5e, 0×6b, 0×56, 0xba, 0×7d,

    0xc0, 0×86, 0xe7, 0×50, 0×88, 0×3a, 0xfe, 0xb4,

    0×11, 0×92, 0×47, 0×3e, 0×78, 0xe9, 0×5b, 0×0b,

    0xaf, 0xf8, 0×33, 0×76, 0×2f, 0xe0, 0×36, 0xc1,

    0×73, 0xde, 0xed, 0xf0, 0xd4, 0×96, 0×85, 0×4c,

    0×5c, 0×36, 0×9b, 0×19, 0×8f, 0×87, 0xdc, 0×6b,

    0×53, 0×76, 0×36, 0xb0, 0xc1, 0xf1, 0×7b, 0xa9,

    0×0d, 0×86, 0xa5, 0×1e, 0xa4, 0×24, 0×16, 0×97,

    0xd1, 0×48, 0×50, 0×72, 0×3b, 0xbd, 0xa5, 0×7d,

    0×0f, 0×3e, 0×55, 0xe2, 0xcf, 0×58, 0xb6, 0xba,

    0xbd, 0×16, 0xf1, 0×6a, 0×30, 0xca, 0xf9, 0xc6,

    0xd1, 0×19, 0×1b, 0xbd, 0×70, 0×7a, 0×13, 0×5c,

    0×5a, 0×0a, 0×9c, 0×1e, 0×2d, 0×3d, 0×49, 0xca };

    char peer0_1[] = {

    0xba, 0×37, 0xf4, 0xd1, 0xd1, 0×16, 0×64, 0xc8,

    0xc6, 0×09, 0xcd, 0×2b, 0xa6, 0×96, 0xe5, 0×3b,

    0×95, 0xce, 0×73, 0xc7, 0xda, 0xa9, 0×20, 0xa0,

    0xa1, 0×87, 0×6b, 0×3b, 0xe0, 0xdb, 0×0e, 0xec,

    0×63, 0×02, 0×80, 0xc5, 0×30, 0xbc, 0xda, 0×50,

    0xe0, 0×1c, 0xf1, 0×42, 0xac, 0×75, 0xd1, 0×9a,

    0×6a, 0×87, 0×8d, 0xa8, 0xbd, 0×7e, 0×46, 0xd3,

    0xf5, 0×0d, 0×52, 0xda, 0×3c, 0×83, 0xaa, 0×43,

    0×19, 0×8b, 0×1f, 0xd6, 0×4e, 0xd6, 0xfe, 0xf5,

    0xda, 0xe1, 0xfc, 0×8a, 0xe6, 0xe6, 0×28, 0×46,

    0×05, 0xe5, 0×82, 0xc5, 0×1e, 0×3f, 0xf9, 0×14,

    0×84, 0xfb, 0×1a, 0xaa, 0xbd, 0xd1, 0xad, 0xef,

    0xae, 0xed, 0×2e, 0×66, 0×0d, 0xde, 0×5a, 0xb6,

    0xe4, 0xc1, 0xe0, 0xf9, 0xf3, 0xeb, 0xc8, 0xae,

    0xd4, 0xb4, 0×6b, 0×7d, 0×46, 0×5b, 0×69, 0×2e,

    0×03, 0×16, 0xb6, 0×7d, 0xe9, 0xb4, 0xe3, 0×27,

    0×8e, 0×0f, 0xbb, 0×81, 0×54, 0×02, 0×80, 0×1e,

    0xeb, 0xdd, 0×26, 0xc4, 0xcd, 0xd5, 0xfd, 0xfd,

    0×75, 0xf8, 0×53, 0×9a, 0×55, 0×94, 0×50, 0xf6,

    0×8f, 0xd9, 0×6e, 0×14, 0×33, 0×5a, 0×59, 0xc6,

    0×2d, 0xd5, 0xba, 0×74, 0xf1, 0×10, 0×3d, 0×72,

    0×4d, 0×6b, 0xdb, 0×08, 0×6d, 0xc3, 0×69, 0xd2,

    0×95, 0×55, 0xb9, 0xf6, 0xa4, 0×55, 0×20, 0×60,

    0xb2, 0xe7, 0×9c, 0xfa, 0×80, 0×71, 0×4e, 0xf5,

    0×5d, 0×12, 0xdb, 0×54, 0×31, 0xbc, 0xdd, 0xe2,

    0×4d, 0×17, 0xfa, 0×73, 0×44, 0xdb, 0×5d, 0×7e,

    0×7e, 0×94, 0×18, 0xec, 0×95, 0×9b, 0×32, 0xc9,

    0×34, 0xd7, 0×73, 0xcc, 0xae, 0xae, 0×25, 0×96,

    0×5c, 0xb0, 0xda, 0×72, 0×07, 0×4e, 0×95, 0xc7,

    0×63, 0×63, 0×63, 0xdf, 0xfd, 0×50, 0xd9, 0×1b,

    0×98, 0×79, 0×3f, 0×65, 0×34, 0xaa, 0×0f, 0×67,

    0×2d, 0×49, 0×00, 0×9f, 0xcd, 0×71, 0×92, 0×3c,

    0xb7, 0×1a, 0×6f, 0×1d, 0xb4, 0×6f, 0xdb, 0×0d,

    0×49, 0xbb, 0xa4, 0×67, 0×86, 0xd9, 0×0c, 0×40,

    0xa8, 0xc0, 0×62, 0×3c, 0×85, 0×34, 0×1d, 0×9a,

    0xb4, 0×16, 0×51, 0xda, 0xee, 0×9b, 0xbb, 0×8e,

    0xe3, 0xda, 0×01, 0xdc, 0×33, 0xbb, 0×39, 0xf4,

    0xe9, 0×44, 0xa6, 0×99, 0×14, 0×5a, 0×94, 0xf7,

    0xca, 0×5f, 0xbe, 0×9d, 0×15, 0×18, 0×13, 0xe1,

    0xc0, 0xe9, 0×81, 0×5d, 0×44, 0×93, 0×5a, 0xbf,

    0xc0, 0×52, 0xe9, 0×9b, 0xba, 0xfa, 0xff, 0×00,

    0×6a, 0×5f, 0xb2, 0xed, 0×7e, 0×34, 0xce, 0xf2,

    0xd6, 0xc2, 0xd6, 0×76, 0×95, 0xd8, 0xcb, 0×2c,

    0×97, 0×18, 0×76, 0×6c, 0xf2, 0×18, 0×63, 0×8f,

    0×85, 0×67, 0xec, 0×1d, 0xec, 0×7a, 0×95, 0xb4,

    0xf3, 0×59, 0xd8, 0xc7, 0×3c, 0xd1, 0×98, 0xe3,

    0×49, 0×84, 0×8b, 0×1c, 0xc3, 0xf9, 0×48, 0×1d,

    0×33, 0xe9, 0xfe, 0xd4, 0xf2, 0xef, 0xb3, 0×96,

    0xd2, 0xdc, 0xc9, 0×3c, 0×33, 0×5d, 0×5a, 0×3c,

    0xa7, 0×32, 0×0b, 0×79, 0×36, 0xab, 0×9f, 0×52,

    0×3d, 0×6b, 0xdf, 0xe4, 0×56, 0×03, 0×4d, 0×6b,

    0×0e, 0xe4, 0xf7, 0×25, 0xb7, 0×13, 0xbb, 0xc7,

    0xbb, 0xfa, 0xb7, 0×7a, 0xd4, 0×96, 0×93, 0xe2 };

Leave a Reply

Click here to cancel reply.

 
  • Blog Archive

    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
  • Search This Blog

  • RSS Subscribe Now

    • Koobface on Yuotube
    • Spamvertizing Social Networks and Why Legitimate Money Will Help Clean Them Up
    • Zbot: Not Your Typical Malware
  • Categories

  • About ThreatFire

    ThreatFire™, features innovative real-time behavioral protection technology that provides powerful standalone protection or the perfect complement to traditional signature-based antivirus programs.

    ThreatFire's patent-pending ActiveDefense™ technology offers unsurpassed protection against both known and unknown zero-day viruses, worms, trojans, rootkits, buffer overflows, spyware, adware and other malware.

    Learn more...

  • Blogroll

    • AV-Comparatives weblog
    • Bill Mullins’ Weblog – Tech Thoughts
    • Security Response Blogs
    • Swatkat’s rants
    • ThreatExpert Blog
  • Links

    • AMTSO
    • AV-Test
    • Frank Boldewin’s Reconstructor
    • PC Tools
    • ThreatExpert
    • ThreatFire
    • Virus Bulletin
 
Subscribe to:
Posts (Atom)
Entries (RSS) and Comments (RSS).