Changeset 429

Show
Ignore:
Timestamp:
03/26/06 03:41:42 (3 years ago)
Author:
common
Message:

shellcode-signatures
- fixed 2 xor:: patterns in signature file, i hope they are all ready now
- namespace url:: added
- namespace execute:: added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/modules/shellcode-signatures/Makefile.am

    r428 r429  
    1818shellcodesignatures_la_SOURCES += sch_namespace_bindshell.cpp sch_namespace_bindshell.hpp 
    1919shellcodesignatures_la_SOURCES += sch_namespace_connectbackshell.cpp sch_namespace_connectbackshell.hpp 
     20shellcodesignatures_la_SOURCES += sch_namespace_execute.cpp sch_namespace_execute.hpp 
     21shellcodesignatures_la_SOURCES += sch_namespace_url.cpp sch_namespace_url.hpp 
    2022 
    2123shellcodesignatures_la_LDFLAGS = -module -no-undefined -avoid-version 
  • nepenthes/trunk/modules/shellcode-signatures/lex.yy.c

    r426 r429  
    10061006YY_RULE_SETUP 
    10071007#line 66 "parser.l" 
    1008 { return SC_PRELOAD; } 
     1008{ return SC_POSTLOAD; } 
    10091009        YY_BREAK 
    10101010case 35: 
    10111011YY_RULE_SETUP 
    1012 #line 68 "parser.l" 
     1012#line 69 "parser.l" 
    10131013{ string_append(yytext, strlen(yytext)); return SC_ID; } 
    10141014        YY_BREAK 
    10151015case 36: 
    10161016YY_RULE_SETUP 
    1017 #line 71 "parser.l" 
     1017#line 72 "parser.l" 
    10181018{ BEGIN(comment); } 
    10191019        YY_BREAK 
    10201020case 37: 
    10211021YY_RULE_SETUP 
    1022 #line 72 "parser.l" 
     1022#line 73 "parser.l" 
    10231023{ } 
    10241024        YY_BREAK 
    10251025case 38: 
    10261026YY_RULE_SETUP 
    1027 #line 73 "parser.l" 
     1027#line 74 "parser.l" 
    10281028{ BEGIN(INITIAL); } 
    10291029        YY_BREAK 
    10301030case 39: 
    10311031YY_RULE_SETUP 
    1032 #line 74 "parser.l" 
     1032#line 75 "parser.l" 
    10331033{ } 
    10341034        YY_BREAK 
     
    10361036/* rule 40 can match eol */ 
    10371037YY_RULE_SETUP 
    1038 #line 75 "parser.l" 
     1038#line 76 "parser.l" 
    10391039{ line_number++; } 
    10401040        YY_BREAK 
    10411041case 41: 
    10421042YY_RULE_SETUP 
    1043 #line 77 "parser.l" 
     1043#line 78 "parser.l" 
    10441044{ BEGIN(string); } 
    10451045        YY_BREAK 
    10461046case 42: 
    10471047YY_RULE_SETUP 
    1048 #line 78 "parser.l" 
     1048#line 79 "parser.l" 
    10491049{ BEGIN(INITIAL); return SC_STRING; } 
    10501050        YY_BREAK 
    10511051case 43: 
    10521052YY_RULE_SETUP 
    1053 #line 79 "parser.l" 
     1053#line 80 "parser.l" 
    10541054{ string_append("\n", 1); } 
    10551055        YY_BREAK 
    10561056case 44: 
    10571057YY_RULE_SETUP 
    1058 #line 80 "parser.l" 
     1058#line 81 "parser.l" 
    10591059{ string_append("\r", 1); } 
    10601060        YY_BREAK 
    10611061case 45: 
    10621062YY_RULE_SETUP 
    1063 #line 81 "parser.l" 
     1063#line 82 "parser.l" 
    10641064{ string_append("\t", 1); } 
    10651065        YY_BREAK 
    10661066case 46: 
    10671067YY_RULE_SETUP 
    1068 #line 82 "parser.l" 
     1068#line 83 "parser.l" 
    10691069{ string_append("\"", 1); } 
    10701070        YY_BREAK 
    10711071case 47: 
    10721072YY_RULE_SETUP 
    1073 #line 83 "parser.l" 
     1073#line 84 "parser.l" 
    10741074{ string_append("\0", 1); } 
    10751075        YY_BREAK 
    10761076case 48: 
    10771077YY_RULE_SETUP 
    1078 #line 84 "parser.l" 
     1078#line 85 "parser.l" 
    10791079{ string_append("\\", 1); } 
    10801080        YY_BREAK 
    10811081case 49: 
    10821082YY_RULE_SETUP 
    1083 #line 85 "parser.l" 
     1083#line 86 "parser.l" 
    10841084{ 
    10851085        char hexval[] = {'0', 'x', *(yytext + 2), *(yytext + 3), '\0'}; 
     
    10931093/* rule 50 can match eol */ 
    10941094YY_RULE_SETUP 
    1095 #line 92 "parser.l" 
     1095#line 93 "parser.l" 
    10961096{ string_append(yytext, strlen(yytext)); } 
    10971097        YY_BREAK 
    10981098case 51: 
    10991099YY_RULE_SETUP 
    1100 #line 94 "parser.l" 
     1100#line 95 "parser.l" 
    11011101{ } 
    11021102        YY_BREAK 
    11031103case 52: 
    11041104YY_RULE_SETUP 
    1105 #line 96 "parser.l" 
     1105#line 97 "parser.l" 
    11061106{ } 
    11071107        YY_BREAK 
     
    11091109/* rule 53 can match eol */ 
    11101110YY_RULE_SETUP 
    1111 #line 97 "parser.l" 
     1111#line 98 "parser.l" 
    11121112{ line_number++; } 
    11131113        YY_BREAK 
    11141114case 54: 
    11151115YY_RULE_SETUP 
    1116 #line 99 "parser.l" 
     1116#line 100 "parser.l" 
    11171117ECHO; 
    11181118        YY_BREAK 
     
    20862086#undef YY_DECL 
    20872087#endif 
    2088 #line 99 "parser.l" 
     2088#line 100 "parser.l" 
    20892089 
    20902090 
  • nepenthes/trunk/modules/shellcode-signatures/sch_namespace_xor.cpp

    r428 r429  
    9999 
    100100 
    101 // data before xo
     101// decode
    102102        const char  *decoderMatch=  NULL; 
    103103        uint32_t    decoderSize =   0; 
  • nepenthes/trunk/modules/shellcode-signatures/shellcode-signatures.cpp

    r428 r429  
    4242#include "sch_namespace_bindshell.hpp" 
    4343#include "sch_namespace_connectbackshell.hpp" 
     44#include "sch_namespace_execute.hpp" 
     45#include "sch_namespace_url.hpp" 
    4446 
    4547#include "ShellcodeManager.hpp" 
     
    152154 
    153155                case sc_execute: 
     156                        sch = new NamespaceExecute(sc); 
    154157                        break; 
    155158 
     
    158161 
    159162                case sc_url: 
     163                        sch = new NamespaceUrl(sc); 
    160164                        break; 
    161165 
  • nepenthes/trunk/modules/shellcode-signatures/shellcode-signatures.sc

    r428 r429  
    121121        "(.*)(\\x31\\xC9\\x83\\xE9(.)\\xD9\\xEE\\xD9\\x74\\x24\\xF4\\x5B\\x81\\x73\\x13(....)" 
    122122        "\\x83\\xEB\\xFC\\xE2\\xF4)(.*)$"; 
    123         mapping (none,pre,pcre,key,sizeinvert,post); 
     123        mapping (none,pre,pcre,sizeinvert,key,post); 
    124124}; 
    125125 
     
    150150}; 
    151151 
     152 
    152153xor::msfPexEnvSub 
    153154{ 
     
    155156        "(.*)(\\xC9\\x83\\xE9(.)\\xD9\\xEE\\xD9\\x74\\x24\\xF4\\x5B\\x81\\x73\\x13(....)\\x83" 
    156157        "\\xEB\\xFC\\xE2\\xF4)(.*)$"; 
    157         mapping (none,pre,pcre,key,sizeinvert,post); 
    158 }; 
     158        mapping (none,pre,pcre,sizeinvert,key,post); 
     159}; 
     160 
    159161 
    160162xor::msfPex 
  • nepenthes/trunk/modules/shellcode-signatures/y.tab.c

    r426 r429  
    286286#define YYFINAL  2 
    287287/* YYLAST -- Last index in YYTABLE.  */ 
    288 #define YYLAST   45 
     288#define YYLAST   43 
    289289 
    290290/* YYNTOKENS -- Number of terminals. */ 
     
    293293#define YYNNTS  15 
    294294/* YYNRULES -- Number of rules. */ 
    295 #define YYNRULES  41 
     295#define YYNRULES  42 
    296296/* YYNRULES -- Number of states. */ 
    297 #define YYNSTATES  58 
     297#define YYNSTATES  59 
    298298 
    299299/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */ 
     
    348348      46,    49,    51,    53,    55,    58,    63,    66,    67,    71, 
    349349      73,    75,    77,    79,    81,    83,    85,    87,    89,    91, 
    350       95,    96 
     350      93,    97,    98 
    351351}; 
    352352 
     
    363363      -1,    29,    -1,    30,    -1,    31,    -1,    33,    -1,    32, 
    364364      -1,    34,    -1,    35,    -1,    36,    -1,    37,    -1,    38, 
    365       -1,    13,    16,    53,    -1,    -1,    16,    53,    -1 
     365      -1,    11,    -1,    13,    16,    53,    -1,    -1,    16,    53, 
     366      -1 
    366367}; 
    367368 
     
    372373     103,   108,   113,   118,   123,   128,   133,   138,   144,   146, 
    373374     150,   154,   155,   156,   160,   167,   171,   174,   176,   180, 
    374      184,   188,   192,   196,   200,   204,   208,   212,   216,   224
    375      232,   234 
     375     184,   188,   192,   196,   200,   204,   208,   212,   216,   220
     376     228,   236,   238 
    376377}; 
    377378#endif 
     
    414415      43,    43,    43,    43,    43,    43,    43,    43,    44,    44, 
    415416      45,    46,    46,    46,    47,    48,    49,    50,    50,    51, 
    416       51,    51,    51,    51,    51,    51,    51,    51,    51,    52
    417       53,    53 
     417      51,    51,    51,    51,    51,    51,    51,    51,    51,    51
     418      52,    53,    53 
    418419}; 
    419420 
     
    424425       1,     1,     1,     1,     1,     1,     1,     1,     0,     2, 
    425426       2,     1,     1,     1,     2,     4,     2,     0,     3,     1, 
    426        1,     1,     1,     1,     1,     1,     1,     1,     1,     3
    427        0,     2 
     427       1,     1,     1,     1,     1,     1,     1,     1,     1,     1
     428       3,     0,     2 
    428429}; 
    429430 
     
    436437      13,    14,    15,    16,    17,     3,     0,     0,    18,     0, 
    437438       0,     0,     0,     0,    18,     0,    22,    23,    21,     0, 
    438       24,    40,     0,     0,    19,    20,     5,    40,    39,    29, 
    439       30,    31,    33,    32,    34,    35,    36,    37,    38,     0
    440       27,     4,    41,    25,     0,    26,    27,    28 
     439      24,    41,     0,     0,    19,    20,     5,    41,    40,    39, 
     440      29,    30,    31,    33,    32,    34,    35,    36,    37,    38
     441      0,    27,     4,    42,    25,     0,    26,    27,    28 
    441442}; 
    442443 
     
    445446{ 
    446447      -1,     1,    15,    16,    17,    23,    24,    25,    26,    27, 
    447       49,    55,    50,    28,    38 
     448      50,    56,    51,    28,    38 
    448449}; 
    449450 
    450451/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 
    451452   STATE-NUM.  */ 
    452 #define YYPACT_NINF -29 
     453#define YYPACT_NINF -17 
    453454static const yysigned_char yypact[] = 
    454455{ 
    455      -29,     0,   -29,   -29,   -29,   -29,   -29,   -29,   -29,   -29
    456      -29,   -29,   -29,   -29,   -29,   -29,     7,     5,    -1,     6
    457       18,    14,    27,    25,    -1,    24,   -29,   -29,   -29,    31
    458      -29,    19,   -28,    28,   -29,   -29,   -29,    19,   -29,   -29
    459      -29,   -29,   -29,   -29,   -29,   -29,   -29,   -29,   -29,    33
    460       32,   -29,   -29,   -29,   -28,   -29,    32,   -29 
     456     -17,     0,   -17,   -17,   -17,   -17,   -17,   -17,   -17,   -17
     457     -17,   -17,   -17,   -17,   -17,   -17,    -3,    -5,   -11,    -4
     458      -2,    -9,     4,     3,   -11,     2,   -17,   -17,   -17,    10
     459     -17,    -1,     1,     5,   -17,   -17,   -17,    -1,   -17,   -17
     460     -17,   -17,   -17,   -17,   -17,   -17,   -17,   -17,   -17,   -17
     461      11,    21,   -17,   -17,   -17,     1,   -17,    21,   -17 
    461462}; 
    462463 
     
    464465static const yysigned_char yypgoto[] = 
    465466{ 
    466      -29,   -29,   -29,   -29,   -29,    12,   -29,   -29,   -29,   -29
    467      -29,   -17,   -13,   -29,     8 
     467     -17,   -17,   -17,   -17,   -17,    16,   -17,   -17,   -17,   -17
     468     -17,   -16,   -13,   -17,     6 
    468469}; 
    469470 
     
    475476static const unsigned char yytable[] = 
    476477{ 
    477        2,    39,    40,    41,    42,    43,    44,    45,    46,    47
    478       48,    20,    21,    18,    22,    19,    29,     3,     4,     5, 
    479        6,     7,     8,     9,    10,    11,    12,    13,    14,    30
    480       31,    32,    33,    35,    36,    37,    34,    51,    53,    57
    481       54,    56,     0,     0,     0,    52 
     478       2,    20,    21,    18,    22,    19,    29,    31,    32,    30
     479      33,    35,    39,    36,    52,    37,    54,     3,     4,     5, 
     480       6,     7,     8,     9,    10,    11,    12,    13,    14,    55
     481      40,    41,    42,    43,    44,    45,    46,    47,    48,    49
     482      34,    58,    57,    53 
    482483}; 
    483484 
    484 static const yysigned_char yycheck[] = 
    485 { 
    486        0,    29,    30,    31,    32,    33,    34,    35,    36,    37
    487       38,    12,    13,     6,    15,    10,    10,    17,    18,    19, 
    488       20,    21,    22,    23,    24,    25,    26,    27,    28,    11
    489       16,     4,     7,     9,     3,    16,    24,     9,     5,    56
    490       8,    54,    -1,    -1,    -1,    37 
     485static const unsigned char yycheck[] = 
     486{ 
     487       0,    12,    13,     6,    15,    10,    10,    16,     4,    11
     488      7,     9,    11,     3,     9,    16,     5,    17,    18,    19, 
     489      20,    21,    22,    23,    24,    25,    26,    27,    28,    8
     490      29,    30,    31,    32,    33,    34,    35,    36,    37,    38
     491      24,    57,    55,    37 
    491492}; 
    492493 
     
    498499      24,    25,    26,    27,    28,    41,    42,    43,     6,    10, 
    499500      12,    13,    15,    44,    45,    46,    47,    48,    52,    10, 
    500       11,    16,     4,     7,    44,     9,     3,    16,    53,    29
    501       30,    31,    32,    33,    34,    35,    36,    37,    38,    49
    502       51,     9,    53,     5,     8,    50,    51,    50 
     501      11,    16,     4,     7,    44,     9,     3,    16,    53,    11
     502      29,    30,    31,    32,    33,    34,    35,    36,    37,    38
     503      49,    51,     9,    53,     5,     8,    50,    51,    50 
    503504}; 
    504505 
     
    11441145    { 
    11451146                int i; 
    1146                
     1147/*             
    11471148                printf("shellcode:\n"); 
    11481149 
     
    11591160 
    11601161                printf("\n\n"); 
    1161  
     1162*/ 
    11621163                /* prepare for the next one */ 
    11631164                init_shellcode(); 
     
    13351336 
    13361337  case 39: 
    1337 #line 225 "parser.y" 
     1338#line 221 "parser.y" 
     1339    { 
     1340           shellcodes->map[shellcodes->map_items++] = sc_none; 
     1341        } 
     1342    break; 
     1343 
     1344  case 40: 
     1345#line 229 "parser.y" 
    13381346    { 
    13391347                shellcodes->pattern = strndup(string_get_buffer(), string_get_len()); 
     
    13471355 
    13481356/* Line 1037 of yacc.c.  */ 
    1349 #line 1350 "y.tab.c" 
     1357#line 1358 "y.tab.c" 
    13501358  
    13511359  yyvsp -= yylen; 
     
    15751583 
    15761584 
    1577 #line 237 "parser.y" 
     1585#line 241 "parser.y" 
    15781586 
    15791587 
     
    16291637                  "pcre", 
    16301638                  "pre", 
    1631                   "post" 
     1639                  "post", 
     1640                  "none" 
    16321641                }; 
    16331642                if ( num > sizeof(mapmapping)/sizeof(char *) )