Git Product home page Git Product logo

assemblyline-service-pdfid's Introduction

PDFId Service

This Assemblyline service extracts metadata and objects from PDF files using Didier Stevens PDFId (Version 2.7) and PDFParser (Version 7.4) tools.

NOTE: This service does not require you to buy any licence and is preinstalled and working after a default installation

Configuration

  • ADDITIONAL_KEYS: List of keywords searched for by PDFid
  • HEURISTICS: Choose the heuristics plugin to be run during the service execution. Here's the list of plugin to choose from:
    • pdf_id/pdfid/plugin_embeddedfile
    • pdf_id/pdfid/plugin_nameobfuscation
    • pdf_id/pdfid/plugin_suspicious_properties
    • pdf_id/pdfid/plugin_triage
  • MAX_PDF_SIZE: Maximum size PDF to be processed by PDFid. This value will be ignore during deep scan

Execution

The PDFId service will report the following information for each file when present:

File Information

PDFId

  • PDF Header String
  • Number of:
    • objects
    • streams
    • endstreams
    • xref
    • trailer
    • startxref
    • '/Page'
    • '/Encrypt'
    • '/Objstm'
    • '/JS'
    • '/Javascript'
    • '/AA'
    • '/OpenAction'
    • '/AcroForm'
    • '/JBIG2Decode'
    • '/RichMedia'
    • '/Launch'
    • '/Colours'
    • '%%EOF'
    • Bytes after %%EOF
  • Total entropy
  • Entropy inside streams
  • Entropy outside streams
  • Mod Date (AL tag: file.pdf.date.modified)
  • Creation Date (AL tag: file.date.creation)
  • Last Modification Date (AL tag: file.date.last_modified)
  • Source Modified Date (AL tag: file.pdf.date.source_modified)

PDFParser

Note: PDFParser will only run on a sample if in deep scan mode, or if PDFId plugins (see below) detected suspicious elements are present in the sample.

  • Reports number of:

    • /Comment
    • /XREF
    • /Trailer
    • /StartXref
    • /Indirect object
    • /Catalog
    • /ExtGState
    • /Font
    • /FontDescriptor
    • /Pages
  • Extracts PDF Elements:

    • Comments
    • Trailer
    • StartXref
  • Extracts Suspicious Elements:

    • Entire Objects (as extracted file) when flagged by PDFId plugins (JBIG2Decode objects will only be extracted in deep scan mode).
    • Specific Object content (in AL result) and will run FrankenStrings Patterns against content to search for IOCs (determined by PDFId plugins).
  • ObjStms

    • Service will attempt to reprocess object streams in samples as PDF files to re-run against PDFId and PDFParser analyzers. If in deep scan mode, a maximum of 100 objstms will be reprocessed, otherwise a maximum of two will be reprocessed.

PDFId Plugins

PDFId plugins are python scripts used by PDFId service to score suspicious properties based on PDFId results. Plugins can be added to service by users (see configuration above). The following format is required for plugin scripts to work with this AL service:

class cPDFiD[NAME](cPluginParent):
    onlyValidPDF = True
    name = '[NAME OF PLUGIN]'

    def __init__(self, oPDFiD):
        self.oPDFiD = oPDFiD
        # Whether or not hits is used, it must be returned by Score
        self.hits = []

    def Score(self):
        score = 0
        [conditions that might adjust score/self.hits]

        return score, self.hits

    def Instructions(self, score, hits):
        if score == 1000:
            # These messages will show in AL result,
            along with score
            return 'Some message'

        if score == 500:
            return 'Some other message'

        if score == 0:
            return

See source code under "pdfid" folder for examples of plugins already used by this service.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.