├── LICENSE ├── README.md ├── explode_pdf ├── README.md └── explode_pdf.py ├── explode_rtf ├── README.md └── explode_rtf.py ├── log_json ├── README.md └── log_json.py ├── meta_class ├── README.md └── meta_java_class.py ├── meta_histogram ├── README.md └── meta_histogram.py ├── meta_manifest ├── README.md └── meta_java_manifest.py └── meta_olevba ├── README.md └── meta_olevba.py /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2015 Josh Liburdi 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # laikaboss-modules 2 | This repository contains modules that can be added to the Lockheed Martin Laika BOSS framework. See here: https://github.com/lmco/laikaboss. 3 | 4 | This repository is not currently actively supported -- consider it an archive. 5 | 6 | Current modules 7 | --- 8 | explode_pdf.py -- A PDF exploder that uses pdfminer 9 | 10 | explode_rtf.py -- An RTF exploder that uses python-oletools 11 | 12 | meta_java_class.py -- A Java class file parser that uses python-javatools 13 | 14 | meta_histogram.py -- A textual histogram parser 15 | 16 | meta_java_manifest.py -- A Java manifest file parser that uses python-javatools 17 | 18 | meta_olevba.py -- An OLE VBA parser that uses python-oletools 19 | -------------------------------------------------------------------------------- /explode_pdf/README.md: -------------------------------------------------------------------------------- 1 | explode_pdf.py 2 | ================ 3 | 4 | This module explodes PDF files and extracts any streams within the file. It uses pdfminer for stream extraction. 5 | 6 | Sample output 7 | ``` 8 | "objectSize": 10402, 9 | "fileType": [ 10 | "officex" 11 | ], 12 | "level": 2, 13 | "filename": "e_pdf_stream_1430", 14 | "depth": 1, 15 | "sourceModule": "EXPLODE_PDF", 16 | "flags": [], 17 | ``` 18 | 19 | Installation 20 | --- 21 | * Install pdfminer (https://github.com/euske/pdfminer) 22 | * Put explode_pdf.py in directory laikaboss/laikaboss/modules 23 | * Modify dispatch.yara to include the module 24 | ``` 25 | rule type_is_pdf 26 | { 27 | meta: 28 | scan_modules = "EXPLODE_PDF" 29 | file_type = "pdf" 30 | strings: 31 | $pdf1 = { 25 50 44 46 2d ?? 2e } // %PDF-.(dot) 32 | $pdf2 = { 25 50 44 46 2d } 33 | condition: 34 | 35 | ($pdf1 in (0 .. 1024) or $pdf2 at 0) and not (type_is_zip or 36 | type_is_msoffice2007 or 37 | type_is_tar or 38 | type_is_rar) 39 | } 40 | ``` 41 | -------------------------------------------------------------------------------- /explode_pdf/explode_pdf.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Josh Liburdi 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | from laikaboss.si_module import SI_MODULE 16 | from laikaboss.objectmodel import ModuleObject, ExternalVars, ScanError 17 | from pdfminer.pdfparser import PDFParser 18 | from pdfminer.pdfdocument import PDFDocument 19 | from pdfminer.pdftypes import PDFStream, PDFObjectNotFound 20 | from pdfminer.psparser import PSEOF, LIT 21 | import cStringIO 22 | 23 | class EXPLODE_PDF(SI_MODULE): 24 | def __init__(self,): 25 | self.module_name = "EXPLODE_PDF" 26 | 27 | def _run(self, scanObject, result, depth, args): 28 | moduleResult = [] 29 | 30 | pdfBuffer = cStringIO.StringIO(scanObject.buffer) 31 | 32 | try: 33 | pdf = PDFParser(pdfBuffer) 34 | pdfDoc = PDFDocument(pdf) 35 | 36 | for xref in pdfDoc.xrefs: 37 | for objid in xref.get_objids(): 38 | try: 39 | obj = pdfDoc.getobj(objid) 40 | if isinstance(obj, dict): 41 | for (key,val) in obj.iteritems(): 42 | if key in ['AA','OpenAction']: 43 | scanObject.addFlag('pdf:nfo:auto_action') 44 | elif key in ['JS','Javascript']: 45 | scanObject.addFlag('pdf:nfo:js_embedded') 46 | if isinstance(obj, PDFStream): 47 | if 'Type' in obj.attrs and obj.attrs['Type'] == LIT('EmbeddedFile'): 48 | moduleResult.append(ModuleObject(buffer=obj.get_data(), externalVars=ExternalVars(filename='e_pdf_stream_%s' % objid))) 49 | 50 | except PDFObjectNotFound: 51 | scanObject.addFlag('pdf:err:missing_object_%s' % objid) 52 | except ScanError: 53 | raise 54 | 55 | except PSEOF: 56 | scanObject.addFlag('pdf:err:unexpected_eof') 57 | except ScanError: 58 | raise 59 | 60 | return moduleResult 61 | -------------------------------------------------------------------------------- /explode_rtf/README.md: -------------------------------------------------------------------------------- 1 | explode_rtf.py 2 | ================ 3 | 4 | This module explodes RTF files. It uses python-oletools. 5 | python-oletools can be accessed here: http://www.decalage.info/python/oletools 6 | 7 | Sample output 8 | ``` 9 | "objectSize": 3222, 10 | "fileType": [ 11 | "officex" 12 | ], 13 | "level": 2, 14 | "filename": "e_rtf_index_1900063", 15 | "depth": 1, 16 | "sourceModule": "EXPLODE_RTF", 17 | "flags": [], 18 | ``` 19 | 20 | Installation 21 | --- 22 | * Install python-oletools (http://www.decalage.info/python/oletools) 23 | * Put explode_rtf.py in directory laikaboss/laikaboss/modules/ 24 | * Modify dispatch.yara to include the module 25 | ``` 26 | rule type_is_rtf 27 | { 28 | meta: 29 | scan_modules = "EXPLODE_RTF" 30 | file_type = "rtf" 31 | condition: 32 | uint32(0) == 0x74725c7b 33 | } 34 | ``` 35 | -------------------------------------------------------------------------------- /explode_rtf/explode_rtf.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Josh Liburdi 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | from laikaboss.si_module import SI_MODULE 16 | from laikaboss.objectmodel import ModuleObject, ExternalVars 17 | from oletools import rtfobj 18 | 19 | class EXPLODE_RTF(SI_MODULE): 20 | def __init__(self,): 21 | self.module_name = "EXPLODE_RTF" 22 | 23 | def _run(self, scanObject, result, depth, args): 24 | moduleResult = [] 25 | 26 | for index, obj_len, obj_data in rtfobj.rtf_iter_objects(scanObject.buffer): 27 | # index location of the RTF object becomes the file name 28 | name = 'index_' + str(index) 29 | moduleResult.append(ModuleObject(buffer=obj_data, externalVars=ExternalVars(filename='e_rtf_%s' % name))) 30 | 31 | return moduleResult 32 | -------------------------------------------------------------------------------- /log_json/README.md: -------------------------------------------------------------------------------- 1 | log_json.py 2 | ================ 3 | 4 | This module writes the output of Laika results as JSON to a user-specified file. (If no user-specified file is provided, then the file is written to /tmp/laika.log.) When LB is deployed as client-server configuration, this can be used to store results on the server(s) running the laikad service. 5 | 6 | Installation 7 | --- 8 | * Put log_json.py in directory laikaboss/laikaboss/modules/ 9 | * Modify conditional-dispatch.yara to include the module 10 | ``` 11 | rule LOG_JSON 12 | { 13 | meta: 14 | scan_modules = "LOG_JSON(savepath=/path/to/file.log)" 15 | priority = "50" 16 | condition: 17 | root_object 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /log_json/log_json.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Josh Liburdi 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from laikaboss.si_module import SI_MODULE 16 | from laikaboss.clientLib import getJSON 17 | from laikaboss.util import get_option 18 | 19 | class LOG_JSON(SI_MODULE): 20 | '''Module for writing to JSON log on Laika server''' 21 | 22 | def __init__(self,): 23 | self.module_name = "LOG_JSON" 24 | def _run(self, scanObject, result, depth, args): 25 | save_path = get_option(args, 'savepath', 'jsonsavepath', '/tmp/laika.log') 26 | with open(save_path,"ab") as json_out: 27 | json_out.write(getJSON(result) + "\n") 28 | -------------------------------------------------------------------------------- /meta_class/README.md: -------------------------------------------------------------------------------- 1 | meta_java_class.py 2 | ================ 3 | 4 | This module parses Java class files and extracts their constants pool tables, provides classes, and requires classes. It uses python-javatools. 5 | python-javatools can be accessed here: https://github.com/obriencj/python-javatools 6 | 7 | Sample output 8 | ``` 9 | "META_JAVA_CLASS": { 10 | "Constants": { 11 | "50": "jar", 12 | "57": "java/lang/Exception", 13 | "17": "#47.#56", 14 | "47": "#68", 15 | "37": "AppletX.java", 16 | "74": "parseInt", 17 | "55": "#74:#75", 18 | "33": "LineNumberTable", 19 | "52": "lport", 20 | "53": "", 21 | "36": "SourceFile", 22 | "51": "lhost", 23 | "3": "#40", 24 | "35": "", 25 | "1": "#21.#38", 26 | "41": "ACED00057372001B6A6176612E7574696C2E477265676F7269616E43616C656E6461728F3DD7D6E5B0D0C10200014A0010677265676F7269616E4375746F766572787200126A6176612E7574696C2E43616C656E646172E6EA4D1EC8DC5B8E03000B5A000C6172654669656C647353657449000E66697273744461794F665765656B5A0009697354696D655365745A00076C656E69656E744900166D696E696D616C44617973496E46697273745765656B4900096E6578745374616D7049001573657269616C56657273696F6E4F6E53747265616D4A000474696D655B00066669656C64737400025B495B000569735365747400025B5A4C00047A6F6E657400144C6A6176612F7574696C2F54696D655A6F6E653B78700100000001010100000001000000020000000100000121563AFC0E757200025B494DBA602676EAB2A502000078700000001100000001000007D9000000040000001500000004000000120000008A00000002000000030000000100000004000000100000001100000022000002DEFE488C0000000000757200025B5A578F203914B85DE20200007870000000110101010101010101010101010101010101737200186A6176612E7574696C2E53696D706C6554696D655A6F6E65FA675D60D15EF5A603001249000A647374536176696E6773490006656E6444617949000C656E644461794F665765656B490007656E644D6F6465490008656E644D6F6E7468490007656E6454696D6549000B656E6454696D654D6F64654900097261774F666673657449001573657269616C56657273696F6E4F6E53747265616D490008737461727444617949000E73746172744461794F665765656B49000973746172744D6F646549000A73746172744D6F6E7468490009737461727454696D6549000D737461727454696D654D6F64654900097374617274596561725A000B7573654461796C696768745B000B6D6F6E74684C656E6774687400025B42787200126A6176612E7574696C2E54696D655A6F6E6531B3E9F57744ACA10200014C000249447400124C6A6176612F6C616E672F537472696E673B787074000E416D65726963612F446177736F6E0036EE80000000000000000000000000000000000000000000000000FE488C00000000020000000000000000000000000000000000000000000000000000000000757200025B42ACF317F8060854E002000078700000000C1F1C1F1E1F1E1F1F1E1F1E1F770A000000060000000000007571007E0006000000020000000000000000787372000D6D73662E782E4C6F61646572585E8B4C67DDC409D8020000787078FFFFF4E2F964AC000A", 27 | "40": "java/io/ByteArrayInputStream", 28 | "43": "#62:#63", 29 | "42": "#61", 30 | "45": "#30:#65", 31 | "44": "#30:#64", 32 | "23": "J", 33 | "46": "#66:#67", 34 | "49": "#71:#72", 35 | "48": "#69:#70", 36 | "21": "#60", 37 | "20": "#59", 38 | "27": "serializedObject", 39 | "64": "([B)V", 40 | "63": "(Ljava/lang/String;)[B", 41 | "62": "StringToBytes", 42 | "61": "msf/x/PayloadX", 43 | "60": "java/applet/Applet", 44 | "29": "data", 45 | "28": "Ljava/lang/String;", 46 | "30": "", 47 | "65": "(Ljava/io/InputStream;)V", 48 | "66": "readObject", 49 | "67": "()Ljava/lang/Object;", 50 | "68": "msf/x/LoaderX", 51 | "69": "instance", 52 | "34": "init", 53 | "24": "ConstantValue", 54 | "25": "-3238297386635759160l", 55 | "2": "#39", 56 | "5": "#42.#43", 57 | "4": "#41", 58 | "7": "#2.#45", 59 | "6": "#3.#44", 60 | "9": "#47.#48", 61 | "8": "#2.#46", 62 | "18": "#57", 63 | "13": "#51", 64 | "77": "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V", 65 | "76": "bootstrapPayload", 66 | "75": "(Ljava/lang/String;)I", 67 | "12": "#50", 68 | "73": "java/lang/Integer", 69 | "72": "(Ljava/lang/String;)Ljava/lang/String;", 70 | "71": "getParameter", 71 | "70": "Lmsf/x/LoaderX;", 72 | "15": "#53", 73 | "32": "Code", 74 | "58": "#29:#28", 75 | "11": "#20.#49", 76 | "10": "#29", 77 | "39": "java/io/ObjectInputStream", 78 | "38": "#30:#31", 79 | "59": "msf/x/AppletX", 80 | "22": "serialVersionUID", 81 | "14": "#52", 82 | "16": "#54.#55", 83 | "19": "#20.#58", 84 | "54": "#73", 85 | "31": "()V", 86 | "56": "#76:#77" 87 | }, 88 | "Provides": [ 89 | "msf.x.AppletX.():void", 90 | "msf.x.AppletX.init():void", 91 | "msf.x.AppletX.data:java.lang.String", 92 | "msf.x.AppletX" 93 | ], 94 | "Requires": [ 95 | "java.lang.Integer.parseInt(java.lang.String):int", 96 | "java.io.ByteArrayInputStream.(byte[]):void", 97 | "msf.x.LoaderX.bootstrapPayload(java.lang.String,java.lang.String,java.lang.String,int):void", 98 | "msf.x.LoaderX.instance:msf.x.LoaderX", 99 | "java.io.ObjectInputStream.(java.io.InputStream):void", 100 | "java.io.ByteArrayInputStream", 101 | "msf.x.LoaderX", 102 | "msf.x.PayloadX", 103 | "java.lang.Exception", 104 | "java.applet.Applet.():void", 105 | "java.lang.Integer", 106 | "java.applet.Applet", 107 | "msf.x.PayloadX.StringToBytes(java.lang.String):byte[]", 108 | "java.io.ObjectInputStream.readObject():java.lang.Object", 109 | "java.io.ObjectInputStream", 110 | "msf.x.AppletX.getParameter(java.lang.String):java.lang.String" 111 | ] 112 | } 113 | }, 114 | ``` 115 | 116 | Installation 117 | --- 118 | * Install python-javatools (https://github.com/obriencj/python-javatools) 119 | * Put meta_java_class.py in directory laikaboss/laikaboss/modules/ 120 | * Modify dispatch.yara to include the module 121 | ``` 122 | rule type_is_java_class 123 | { 124 | meta: 125 | scan_modules = "META_JAVA_CLASS" 126 | file_type = "class" 127 | condition: 128 | uint32(0) == 0xbebafeca 129 | } 130 | ``` 131 | -------------------------------------------------------------------------------- /meta_class/meta_java_class.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Josh Liburdi 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | from laikaboss.si_module import SI_MODULE 16 | from laikaboss.objectmodel import ScanError 17 | from javatools import unpack_class, Unimplemented, ClassUnpackException 18 | 19 | class META_JAVA_CLASS(SI_MODULE): 20 | def __init__(self,): 21 | self.module_name = "META_JAVA_CLASS" 22 | 23 | def _run(self, scanObject, result, depth, args): 24 | moduleResult = [] 25 | 26 | try: 27 | class_obj = unpack_class(scanObject.buffer) 28 | 29 | class_requires = class_obj.get_requires() 30 | scanObject.addMetadata(self.module_name, 'Requires', class_requires) 31 | 32 | class_provides = class_obj.get_provides() 33 | scanObject.addMetadata(self.module_name, 'Provides', class_provides) 34 | 35 | class_constants = tuple(class_obj.cpool.pretty_constants()) 36 | constantsDict = dict((i,v) for i,t,v in class_constants) 37 | scanObject.addMetadata(self.module_name, 'Constants', constantsDict) 38 | 39 | except ScanError: 40 | raise 41 | except Unimplemented: 42 | scanObject.addFlag('java_class:err:unimplemented_feature') 43 | except ClassUnpackException: 44 | scanObject.addFlag('java_class:err:class_unpack_exception') 45 | 46 | return moduleResult 47 | -------------------------------------------------------------------------------- /meta_histogram/README.md: -------------------------------------------------------------------------------- 1 | meta_histogram.py 2 | ================ 3 | 4 | This module creates a textual histogram for each scanned file. 5 | 6 | Sample output 7 | ``` 8 | "META_HISTOGRAM": { 9 | "HISTOGRAM": { 10 | "}": 132, 11 | "y": 126, 12 | "u": 139, 13 | ... 14 | "\u007f": 157, 15 | "\u0002": 116, 16 | "\u0006": 126 17 | } 18 | }, 19 | ``` 20 | 21 | Installation 22 | --- 23 | * Put meta_histogram.py in directory laikaboss/laikaboss/modules/ 24 | * Modify dispatch.yara to include the module (placed under General Rules) 25 | ``` 26 | rule meta_histogram 27 | { 28 | meta: 29 | scan_modules = "META_HISTOGRAM" 30 | condition: 31 | true 32 | } 33 | ``` 34 | -------------------------------------------------------------------------------- /meta_histogram/meta_histogram.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Josh Liburdi 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | from laikaboss.si_module import SI_MODULE 16 | from collections import Counter 17 | 18 | class META_HISTOGRAM(SI_MODULE): 19 | def __init__(self,): 20 | self.module_name = "META_HISTOGRAM" 21 | 22 | def _run(self, scanObject, result, depth, args): 23 | moduleResult = [] 24 | 25 | histogramDict = Counter(scanObject.buffer) 26 | histogramDict = dict(histogramDict) 27 | 28 | scanObject.addMetadata(self.module_name, "HISTOGRAM", histogramDict) 29 | 30 | return moduleResult 31 | -------------------------------------------------------------------------------- /meta_manifest/README.md: -------------------------------------------------------------------------------- 1 | meta_java_manifest.py 2 | ================ 3 | 4 | This module parses Java manifest files. It uses python-javatools. 5 | python-javatools can be accessed here: https://github.com/obriencj/python-javatools 6 | 7 | Sample output 8 | ``` 9 | "META_JAVA_MANIFEST": { 10 | "Main-Class": "com.zero1.SandroRatClient.DroidJack", 11 | "Manifest-Version": "1.0", 12 | "Class-Path": ". DroidJack_lib/commons-codec-1.6.jar DroidJack_lib/commons-logging-1.1.1.jar DroidJack_lib/fluent-hc-4.2.5.jar DroidJack_lib/httpclient-4.2.5.jar DroidJack_lib/httpclient-cache-4.2.5.jar DroidJack_lib/httpcore-4.2.4.jar DroidJack_lib/httpmime-4.2.5.jar DroidJack_lib/sqljet-1.1.8.jar DroidJack_lib/sqlite-jdbc-3.7.2.jar DroidJack_lib/kryonet-2.21-all.jar DroidJack_lib/quaqua.jar DroidJack_lib/zip4j_1.3.2.jar DroidJack_lib/jaad-0.8.4.jar DroidJack_lib/commons-io-2.4.jar" 13 | } 14 | ``` 15 | 16 | Installation 17 | --- 18 | * Install python-javatools (https://github.com/obriencj/python-javatools) 19 | * Put meta_java_manifest.py in directory laikaboss/laikaboss/modules/ 20 | * Modify dispatch.yara to include the module 21 | ``` 22 | rule type_is_metainf_manifest 23 | { 24 | meta: 25 | scan_modules = "META_JAVA_MANIFEST" 26 | strings: 27 | $a = { 4d 61 6e 69 66 65 73 74 } 28 | condition: 29 | $a at 0 and ext_parentModules contains "EXPLODE_ZIP" 30 | } 31 | ``` 32 | -------------------------------------------------------------------------------- /meta_manifest/meta_java_manifest.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Josh Liburdi 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | from laikaboss.si_module import SI_MODULE 16 | from javatools.manifest import Manifest 17 | 18 | class META_JAVA_MANIFEST(SI_MODULE): 19 | def __init__(self,): 20 | self.module_name = "META_JAVA_MANIFEST" 21 | 22 | def _run(self, scanObject, result, depth, args): 23 | moduleResult = [] 24 | 25 | mf = Manifest() 26 | mf.parse(scanObject.buffer) 27 | 28 | for key,val in mf.items(): 29 | scanObject.addMetadata(self.module_name, key, val) 30 | 31 | return moduleResult 32 | -------------------------------------------------------------------------------- /meta_olevba/README.md: -------------------------------------------------------------------------------- 1 | meta_olevba.py 2 | ================ 3 | 4 | This module identifies VBA macro code in OLE files and parses the code. It uses olevba from python-oletools. 5 | python-oletools can be accessed here: http://www.decalage.info/python/oletools 6 | 7 | Sample output (BlackEnergy .XLS Dropper 97b7577d13cf5e3bf39cbe6d3f0a7732, 01/2016) 8 | ``` 9 | "META_OLEVBA": { 10 | "VBA string": "%TMP%\\vba_macro.exe - Environ(\"TMP\") & \"\\vba_macro.exe\"", 11 | "IOC": "vba_macro.exe - Executable file name", 12 | "Suspicious": [ 13 | "Open - May open a file", 14 | "Shell - May run an executable file or a system command", 15 | "Binary - May read or write a binary file (if combined with Open)", 16 | "Environ - May read system environment variables", 17 | "Put - May write to a file (if combined with Open)", 18 | "Hex Strings - Hex-encoded strings were detected, may be used to obfuscate strings (option --decode to see all)", 19 | "VBA obfuscated Strings - VBA string expressions were detected, may be used to obfuscate strings (option --decode to see all)" 20 | ] 21 | }, 22 | ``` 23 | 24 | Installation 25 | --- 26 | * Install python-oletools (http://www.decalage.info/python/oletools) 27 | * Put meta_olevba.py in directory laikaboss/laikaboss/modules/ 28 | * Modify dispatch.yara to include the module 29 | ``` 30 | rule type_is_msoffice2003 31 | { 32 | meta: 33 | scan_modules = "EXPLODE_OLE(minFileSize=128) META_OLEVBA" 34 | file_type = "ole" 35 | strings: 36 | $a = { D0 CF 11 E0 A1 B1 1A E1 } 37 | condition: 38 | $a at 0 39 | } 40 | ``` 41 | -------------------------------------------------------------------------------- /meta_olevba/meta_olevba.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Josh Liburdi 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | from laikaboss.si_module import SI_MODULE 17 | from laikaboss.objectmodel import ScanError 18 | from oletools.olevba import VBA_Parser 19 | 20 | class META_OLEVBA(SI_MODULE): 21 | def __init__(self,): 22 | self.module_name = "META_OLEVBA" 23 | 24 | def _run(self, scanObject, result, depth, args): 25 | moduleResult = [] 26 | vbaDict = {} 27 | 28 | try: 29 | vbap_buffer = VBA_Parser(scanObject.buffer) 30 | 31 | if vbap_buffer.detect_vba_macros(): 32 | vbap_macro = vbap_buffer.analyze_macros() 33 | for kw_type, keyword, description in vbap_macro: 34 | if kw_type not in vbaDict: 35 | vbaDict[kw_type] = [(keyword)] 36 | else: 37 | vbaDict[kw_type].append(keyword) 38 | 39 | scanObject.addMetadata(self.module_name, 'Artifacts', vbaDict) 40 | 41 | except TypeError: 42 | scanObject.addFlag('olevba:err:type_error') 43 | except ScanError: 44 | raise 45 | 46 | return moduleResult 47 | --------------------------------------------------------------------------------