Il post seguente è stato tradotto, previa autorizzazione, dal blog SANS Computer Forensics

Le informazioni ricavate dai metadati dei documenti possono essere una valida fonte di informazioni per gli investigatori ed il loro valore è indiscusso. I documenti creati utilizzando Microsoft Office compaiono spesso nel corso delle indagini. Parecchi script e software permettono di leggere il formato proprietario dei documenti creati utilizzando Office 2003 e versioni precedenti, di conseguenza non c’è altro da aggiungere per quanto riguarda questi strumenti. Ma non ci sono molti software che possano leggere i metadati nel nuovo formato che utilizza Office 2007 , OpenXML. Così ho deciso di esaminarlo un po’ più accuratamente.

Microsoft ha già pubblicato un documento che descrive abbastanza bene la struttura di OpenXML [ 1 ]. In sostanza un documento creato in OpenXML, è un file compresso con il noto formato ZIP, in modo che possa essere facilmente aperto con qualsiasi software che faccia uso di tale formato (ad esempio, modificando il nome del documento da document.docx a document.zip e utilizzando un software che legga il formato ZIP).

All’interno del file ZIP sono presenti alcune strutture predefinite di file, generalmente file XML che descrivono il documento ed il suo contenuto, facilmente leggibili tramite librerie standard disponibili nei linguaggi di scripting come Perl.

Secondo quanto detto da Microsoft, all’interno dell’archivio ZIP viene creata una cartella chiamata “_rels”. Questa cartella contiene un file chiamato “. Rels” che definisce le relazioni all’interno dell’archivio. Questo dovrebbe essere il primo luogo utile per effettuare il parse del documento. All’interno del file .rels si trovano i tag che definiscono le relazioni del documento:

<Relationship Id="someID" Type="relationshipType" Target="targetPart"/>

I metadati sono memorizzati in file che contengono un tipo di “proprietà * “, generalmente nota come “proprietà core” e “proprietà estesa”. Questi file sono in genere memorizzati secondo il percorso seguente:

  • DocProps / core.xml
  • DocProps / app.xml

    Questi file contengono, quindi, le informazioni effettive dei metadati: chi ha creato il documento, ultimo file salvato, ecc. Per essere in grado di visualizzare i metadati di tali informazioni è necessario estrarre ed effettuare il parse dei documenti.

    A questo proposito ho creato uno script read_open_xml.pl , che effettua il parse dei contenuti del file .rels per individuare i metadati e successivamente estrarli e stamparli sullo schermo. Ecco un esempio di come possa essere utilizzato:

    ./read_open_xml.pl test.docx
    ==========================================================================
     cmd line: ./read_open_xml.pl test.docx
    ==========================================================================
    
    Document name: test.docx
    Date: Tue Jun  9 16:51:23 GMT 2009
    
    --------------------------------------------------------------------------
    File Metadata
    --------------------------------------------------------------------------
     title = my company template
     subject = Document template
     creator = Kristinn Gudjonsson
     keywords = template, word
     description =
     lastModifiedBy = Kristinn Gudjonsson
     revision = 3
     lastPrinted = 2008-08-15T10:14:00Z
     created = 2008-08-15T10:14:00Z
     modified = 2008-08-15T10:14:00Z
     category = template
    --------------------------------------------------------------------------
    Application Metadata
    --------------------------------------------------------------------------
     Template = my_template.dot
     TotalTime = 0
     Pages = 2
     Words = 159
     Characters = 908
     Application = Microsoft Word 12.1.2
     DocSecurity = 0
     Lines = 7
     Paragraphs = 1
     ScaleCrop = false
     Manager = Some dude
     Company = My Company
     LinksUpToDate = false
     CharactersWithSpaces = 1115
     SharedDoc = false
     HyperlinksChanged = false
     AppVersion = 12.0258
    
    copyright, Kristinn Gudjonsson, 2009

    Lo script legge anche la codifica dei caratteri dei documenti XML e ne codifica l’output.

    Lo script è stato creato per essere usato con Linux, grazie ad alcune modifiche che ho apportato, dovrebbe funzionare anche con sistemi operativi Windows (è stato testato su Win XP SP3 con ActivePerl 5,10).

    È possibile scaricare la versione per Windows qui .

    La versione per Windows e per Linux non sono state ancora testate, quindi potrebbero essere ancora instabili ( alcune informazioni per l’installazione sono contenute all’interno dello script stesso)

    Fonte : Office 2007 Metadata

    Metadata information from documents can be a great source of information for investigators and it’s value has often been discussed before. Documents created using Microsoft Office often come up during investigations. There are several scripts and tools out there to read the proprietary binary format of Office documents created using Office 2003 and earlier versions so there is not more to add to those tools. Yet there aren’t that many tools out there that can list the metadata information from the new format that Office 2007 uses, OpenXML. So I decided to examine it a bit further.

    Microsoft has already published a good enough document describing the structure of OpenXML [1]. Essentially a document created in the OpenXML document format is a compressed file, using the well known ZIP format, so it can be easily opened using any ZIP tool (for instance by modifying the name of the document from document.docx to document.zip and using a standard ZIP tool).

    Inside the ZIP file are predefined structures of files, mostly XML files that describe the document and it’s content. So it can be easily read using standard available libraries in scripting languages such as Perl.

    According to Microsoft a folder is created inside the ZIP archive called “_rels”. This folder contains a file named “.rels” which defines the root relationships within the package. This should be the first place to be able to parse the content of the document. Whithin the .res file you find tags that define the relationship of the document:

    <Relationship Id="someID" Type="relationshipType" Target="targetPart"/>

    Metadata is stored in files that contain a type of “*properties”, most notable the “core-properties” and “extended-properties”. These files are usually stored in the following location:

    • docProps/core.xml
    • docProps/app.xml

    These files then contain the actual metadata information, such as document creator, last saved by information, etc. To be able to display the metadata information it is necessary to extract and parse these documents.

    To do this I wrote the script read_open_xml.pl that parses the contents of the .rels file to locate metadata information from the document and then extracts the metadata and prints it to the screen. Example usage is:

    ./read_open_xml.pl test.docx
    ==========================================================================
     cmd line: ./read_open_xml.pl test.docx
    ==========================================================================
    
    Document name: test.docx
    Date: Tue Jun  9 16:51:23 GMT 2009
    
    --------------------------------------------------------------------------
    File Metadata
    --------------------------------------------------------------------------
     title = my company template
     subject = Document template
     creator = Kristinn Gudjonsson
     keywords = template, word
     description =
     lastModifiedBy = Kristinn Gudjonsson
     revision = 3
     lastPrinted = 2008-08-15T10:14:00Z
     created = 2008-08-15T10:14:00Z
     modified = 2008-08-15T10:14:00Z
     category = template
    --------------------------------------------------------------------------
    Application Metadata
    --------------------------------------------------------------------------
     Template = my_template.dot
     TotalTime = 0
     Pages = 2
     Words = 159
     Characters = 908
     Application = Microsoft Word 12.1.2
     DocSecurity = 0
     Lines = 7
     Paragraphs = 1
     ScaleCrop = false
     Manager = Some dude
     Company = My Company
     LinksUpToDate = false
     CharactersWithSpaces = 1115
     SharedDoc = false
     HyperlinksChanged = false
     AppVersion = 12.0258
    
    copyright, Kristinn Gudjonsson, 2009

    The script also reads the character encoding of the XML documents and encodes the output accordingly.

    The script was created to be used in Linux however I modified the script slightly so it should work on a Windows OS (tested on a Win XP SP3 using ActivePerl 5.10). You can get the Windows version here. The Windows version has not been tested as well as the Linux one, so it might still be little bit more unstable (there are some installation information contained within the script itself)

    Source : Office 2007 Metadata

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.