1

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 in Online Fraud. Bookmark the permalink.

One Response to Tool for shellcode analysis

  1. Ô¿Ô says:

    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, 0x2f, 0×31, 0x2e, 0×30,

    0×20, 0×32, 0×30, 0×30, 0×20, 0x4f, 0x4b, 0x0d,

    0x0a, 0×53, 0×65, 0×72, 0×76, 0×65, 0×72, 0x3a,

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

    0x0a, 0×45, 0×54, 0×61, 0×67, 0x3a, 0×20, 0×22,

    0×32, 0×37, 0×32, 0×61, 0×35, 0×32, 0x2d, 0×31,

    0×32, 0×62, 0×61, 0x2d, 0×37, 0×36, 0×31, 0×38,

    0×38, 0×66, 0×30, 0×30, 0×22, 0x0d, 0x0a, 0×41,

    0×63, 0×63, 0×65, 0×70, 0×74, 0x2d, 0×52, 0×61,

    0x6e, 0×67, 0×65, 0×73, 0x3a, 0×20, 0×62, 0×79,

    0×74, 0×65, 0×73, 0x0d, 0x0a, 0×43, 0x6f, 0x6e,

    0×74, 0×65, 0x6e, 0×74, 0x2d, 0x4c, 0×65, 0x6e,

    0×67, 0×74, 0×68, 0x3a, 0×20, 0×34, 0×37, 0×39,

    0×34, 0x0d, 0x0a, 0×43, 0×61, 0×63, 0×68, 0×65,

    0x2d, 0×43, 0x6f, 0x6e, 0×74, 0×72, 0x6f, 0x6c,

    0x3a, 0×20, 0x6d, 0×61, 0×78, 0x2d, 0×61, 0×67,

    0×65, 0x3d, 0×38, 0×36, 0×34, 0×30, 0×30, 0x0d,

    0x0a, 0×43, 0x6f, 0x6e, 0×74, 0×65, 0x6e, 0×74,

    0x2d, 0×54, 0×79, 0×70, 0×65, 0x3a, 0×20, 0×69,

    0x6d, 0×61, 0×67, 0×65, 0x2f, 0x6a, 0×70, 0×65,

    0×67, 0x0d, 0x0a, 0×41, 0×67, 0×65, 0x3a, 0×20,

    0×31, 0×32, 0×36, 0×30, 0×34, 0x0d, 0x0a, 0×44,

    0×61, 0×74, 0×65, 0x3a, 0×20, 0×54, 0×75, 0×65,

    0x2c, 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,

    0x3a, 0×31, 0×32, 0x3a, 0×33, 0×35, 0×20, 0×47,

    0x4d, 0×54, 0x0d, 0x0a, 0x4c, 0×61, 0×73, 0×74,

    0x2d, 0x4d, 0x6f, 0×64, 0×69, 0×66, 0×69, 0×65,

    0×64, 0x3a, 0×20, 0x4d, 0x6f, 0x6e, 0x2c, 0×20,

    0×31, 0×37, 0×20, 0x4d, 0×61, 0×72, 0×20, 0×32,

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

    0×35, 0x3a, 0×30, 0×30, 0×20, 0×47, 0x4d, 0×54,

    0x0d, 0x0a, 0×45, 0×78, 0×70, 0×69, 0×72, 0×65,

    0×73, 0x3a, 0×20, 0×57, 0×65, 0×64, 0x2c, 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, 0x3a, 0×34,

    0×32, 0x3a, 0×33, 0×31, 0×20, 0×47, 0x4d, 0×54,

    0x0d, 0x0a, 0×43, 0x6f, 0x6e, 0x6e, 0×65, 0×63,

    0×74, 0×69, 0x6f, 0x6e, 0x3a, 0×20, 0×63, 0x6c,

    0x6f, 0×73, 0×65, 0x0d, 0x0a, 0x0d, 0x0a, 0xff,

    0xd8, 0xff, 0xe0, 0×00, 0×10, 0x4a, 0×46, 0×49,

    0×46, 0×00, 0×01, 0×01, 0×01, 0×01, 0x2c, 0×01,

    0x2c, 0×00, 0×00, 0xff, 0xdb, 0×00, 0×43, 0×00,

    0x0b, 0×07, 0×08, 0x0a, 0×08, 0×07, 0x0b, 0x0a,

    0×09, 0x0a, 0x0c, 0x0c, 0x0b, 0x0d, 0×10, 0x1b,

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

    0×14, 0x1b, 0×27, 0×23, 0×29, 0×29, 0×27, 0×23,

    0×26, 0×25, 0x2c, 0×31, 0x3f, 0×35, 0x2c, 0x2e,

    0x3b, 0x2f, 0×25, 0×26, 0×36, 0x4a, 0×37, 0x3b,

    0×41, 0×43, 0×46, 0×47, 0×46, 0x2a, 0×34, 0x4d,

    0×52, 0x4c, 0×44, 0×52, 0x3f, 0×45, 0×46, 0×43,

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

    0×10, 0x0e, 0×10, 0×20, 0×12, 0×12, 0×20, 0×43,

    0x2d, 0×26, 0x2d, 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, 0x6e, 0×03, 0×01,

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

    0xff, 0xc4, 0×00, 0x1c, 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, 0x3c, 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, 0x2c, 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,

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

    0×00, 0x3f, 0×00, 0xfa, 0x1c, 0xf2, 0×18, 0×58,

    0×39, 0×39, 0×00, 0×79, 0×50, 0x2b, 0×36, 0×30,

    0×39, 0xe1, 0xb3, 0×45, 0xdf, 0×95, 0×31, 0x9c,

    0×67, 0xca, 0×97, 0xe3, 0x3c, 0×64, 0x8c, 0xf1,

    0x9f, 0x4a, 0×79, 0×80, 0×63, 0×69, 0×37, 0x9d,

    0xd2, 0x2a, 0x4b, 0xb0, 0xe1, 0xb1, 0x9f, 0×10,

    0xc7, 0x4a, 0xce, 0x3b, 0x8d, 0xac, 0×84, 0xe7,

    0xc3, 0xee, 0xa4, 0x5a, 0×06, 0xa1, 0×34, 0xd6,

    0×17, 0×06, 0xfd, 0xf7, 0x4f, 0×69, 0x2b, 0xa4,

    0xad, 0×80, 0×38, 0x5e, 0x7c, 0xbd, 0xd5, 0x9f,

    0×65, 0×35, 0×69, 0×75, 0x2b, 0×29, 0x9e, 0xed,

    0xb3, 0×24, 0×52, 0×12, 0x4e, 0×31, 0×84, 0×23,

    0×23, 0xf6, 0xcd, 0x5a, 0x9b, 0x4a, 0xce, 0x8d,

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

    0x0c, 0xf2, 0x7d, 0x2b, 0xa2, 0xb9, 0xd8, 0×41,

    0×39, 0xe3, 0xdd, 0×53, 0x5a, 0x4e, 0xb4, 0xab,

    0xa5, 0xb5, 0xf6, 0xa9, 0×74, 0xa8, 0×93, 0x4c,

    0xfd, 0xc8, 0×61, 0x8f, 0×00, 0×38, 0×00, 0×01,

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

    0x5d, 0xa6, 0×37, 0xaa, 0×60, 0×82, 0x0e, 0x4f,

    0x4e, 0×31, 0x9a, 0×92, 0xd0, 0×02, 0xe3, 0x1c,

    0×80, 0xf0, 0x9b, 0xcb, 0x3e, 0xfc, 0xe3, 0x3c,

    0xfb, 0xab, 0×48, 0xee, 0xc2, 0x1e, 0×73, 0xd3,

    0xd2, 0xa2, 0xee, 0xf5, 0xd9, 0x2d, 0×74, 0xfb,

    0×71, 0xf9, 0×94, 0×53, 0x5c, 0×35, 0xd7, 0×89,

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

    0xe9, 0x4c, 0xee, 0×35, 0xcb, 0x1c, 0×93, 0x1e,

    0xa5, 0×12, 0×06, 0×08, 0×50, 0x6c, 0×24, 0x9c,

    0xf4, 0xf8, 0xe7, 0xfb, 0×54, 0×00, 0x1c, 0×14,

    0×98, 0xa4, 0x6e, 0xd3, 0xc7, 0x9b, 0×77, 0xd7,

    0x3d, 0x2b, 0×54, 0xbc, 0x0a, 0x0e, 0×41, 0xe4,

    0×63, 0xa5, 0x4f, 0x5e, 0x6b, 0×56, 0xba, 0x7d,

    0xc0, 0×86, 0xe7, 0×50, 0×88, 0x3a, 0xfe, 0xb4,

    0×11, 0×92, 0×47, 0x3e, 0×78, 0xe9, 0x5b, 0x0b,

    0xaf, 0xf8, 0×33, 0×76, 0x2f, 0xe0, 0×36, 0xc1,

    0×73, 0xde, 0xed, 0xf0, 0xd4, 0×96, 0×85, 0x4c,

    0x5c, 0×36, 0x9b, 0×19, 0x8f, 0×87, 0xdc, 0x6b,

    0×53, 0×76, 0×36, 0xb0, 0xc1, 0xf1, 0x7b, 0xa9,

    0x0d, 0×86, 0xa5, 0x1e, 0xa4, 0×24, 0×16, 0×97,

    0xd1, 0×48, 0×50, 0×72, 0x3b, 0xbd, 0xa5, 0x7d,

    0x0f, 0x3e, 0×55, 0xe2, 0xcf, 0×58, 0xb6, 0xba,

    0xbd, 0×16, 0xf1, 0x6a, 0×30, 0xca, 0xf9, 0xc6,

    0xd1, 0×19, 0x1b, 0xbd, 0×70, 0x7a, 0×13, 0x5c,

    0x5a, 0x0a, 0x9c, 0x1e, 0x2d, 0x3d, 0×49, 0xca };

    char peer0_1[] = {

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

    0xc6, 0×09, 0xcd, 0x2b, 0xa6, 0×96, 0xe5, 0x3b,

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

    0xa1, 0×87, 0x6b, 0x3b, 0xe0, 0xdb, 0x0e, 0xec,

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

    0xe0, 0x1c, 0xf1, 0×42, 0xac, 0×75, 0xd1, 0x9a,

    0x6a, 0×87, 0x8d, 0xa8, 0xbd, 0x7e, 0×46, 0xd3,

    0xf5, 0x0d, 0×52, 0xda, 0x3c, 0×83, 0xaa, 0×43,

    0×19, 0x8b, 0x1f, 0xd6, 0x4e, 0xd6, 0xfe, 0xf5,

    0xda, 0xe1, 0xfc, 0
    x8a, 0xe6, 0xe6, 0×28, 0×46,

    0×05, 0xe5, 0×82, 0xc5, 0x1e, 0x3f, 0xf9, 0×14,

    0×84, 0xfb, 0x1a, 0xaa, 0xbd, 0xd1, 0xad, 0xef,

    0xae, 0xed, 0x2e, 0×66, 0x0d, 0xde, 0x5a, 0xb6,

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

    0xd4, 0xb4, 0x6b, 0x7d, 0×46, 0x5b, 0×69, 0x2e,

    0×03, 0×16, 0xb6, 0x7d, 0xe9, 0xb4, 0xe3, 0×27,

    0x8e, 0x0f, 0xbb, 0×81, 0×54, 0×02, 0×80, 0x1e,

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

    0×75, 0xf8, 0×53, 0x9a, 0×55, 0×94, 0×50, 0xf6,

    0x8f, 0xd9, 0x6e, 0×14, 0×33, 0x5a, 0×59, 0xc6,

    0x2d, 0xd5, 0xba, 0×74, 0xf1, 0×10, 0x3d, 0×72,

    0x4d, 0x6b, 0xdb, 0×08, 0x6d, 0xc3, 0×69, 0xd2,

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

    0xb2, 0xe7, 0x9c, 0xfa, 0×80, 0×71, 0x4e, 0xf5,

    0x5d, 0×12, 0xdb, 0×54, 0×31, 0xbc, 0xdd, 0xe2,

    0x4d, 0×17, 0xfa, 0×73, 0×44, 0xdb, 0x5d, 0x7e,

    0x7e, 0×94, 0×18, 0xec, 0×95, 0x9b, 0×32, 0xc9,

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

    0x5c, 0xb0, 0xda, 0×72, 0×07, 0x4e, 0×95, 0xc7,

    0×63, 0×63, 0×63, 0xdf, 0xfd, 0×50, 0xd9, 0x1b,

    0×98, 0×79, 0x3f, 0×65, 0×34, 0xaa, 0x0f, 0×67,

    0x2d, 0×49, 0×00, 0x9f, 0xcd, 0×71, 0×92, 0x3c,

    0xb7, 0x1a, 0x6f, 0x1d, 0xb4, 0x6f, 0xdb, 0x0d,

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

    0xa8, 0xc0, 0×62, 0x3c, 0×85, 0×34, 0x1d, 0x9a,

    0xb4, 0×16, 0×51, 0xda, 0xee, 0x9b, 0xbb, 0x8e,

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

    0xe9, 0×44, 0xa6, 0×99, 0×14, 0x5a, 0×94, 0xf7,

    0xca, 0x5f, 0xbe, 0x9d, 0×15, 0×18, 0×13, 0xe1,

    0xc0, 0xe9, 0×81, 0x5d, 0×44, 0×93, 0x5a, 0xbf,

    0xc0, 0×52, 0xe9, 0x9b, 0xba, 0xfa, 0xff, 0×00,

    0x6a, 0x5f, 0xb2, 0xed, 0x7e, 0×34, 0xce, 0xf2,

    0xd6, 0xc2, 0xd6, 0×76, 0×95, 0xd8, 0xcb, 0x2c,

    0×97, 0×18, 0×76, 0x6c, 0xf2, 0×18, 0×63, 0x8f,

    0×85, 0×67, 0xec, 0x1d, 0xec, 0x7a, 0×95, 0xb4,

    0xf3, 0×59, 0xd8, 0xc7, 0x3c, 0xd1, 0×98, 0xe3,

    0×49, 0×84, 0x8b, 0x1c, 0xc3, 0xf9, 0×48, 0x1d,

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

    0xd2, 0xdc, 0xc9, 0x3c, 0×33, 0x5d, 0x5a, 0x3c,

    0xa7, 0×32, 0x0b, 0×79, 0×36, 0xab, 0x9f, 0×52,

    0x3d, 0x6b, 0xdf, 0xe4, 0×56, 0×03, 0x4d, 0x6b,

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>