Malware

Malicious file analysis – Example 01

Cyber Security Specialist Zoziel Pinto Freire shows an example of malicious file analysis presented during his lecture on BSides-Vitória 2022.

My objective with this series of articles is to show examples of malicious file analysis that I presented during my lecture on BSides-Vitória 2022.

For this first one, I’ll briefly introduce some crucial topics to ease the understanding of the analysis process.

What’re malicious files?

  • Files that contains in their internal structure malicious actions that could compromise an environment, account, workstation, server, or user will receive the file.

Some files are more used in attacks

Compressed files

  • ZIP, RAR e 7z

Microsoft Office Documents

  • DOC, DOCX, XLS, XLSX, XLSM

PDF files

Microsoft Office Documents

  • From a security point of view files of the types DOC, DOCX, XLS, XLSX, and XLSM, have a common issue, they can contain macros which are embedded scripts that are executed inside the file.

PDF Files

  • PDF files can be used to execute JavaScript, download files, access URLs, and execute commands.
  • Often instead of very malicious links, and induce the user to click on something.

Static Analysis x Dynamic Analysis

  • Static analysis is done without the execution or opening the file/code.
  • Dynamic analysis is done during the execution or opening the file/code.

Tools

Peframe

  • PEframe is an open source tool to perform static analysis of malware executables and malicious MS Office documents.
  • Example: peframe file_name

Pdf-parser

  • PdfParser, a standalone PHP library, provides various tools to extract data from a PDF file.
  • Example: python2.7 pdf-parser.py file_name

Peepdf

  • peepdf is a Python tool to explore PDF files to find out if the file can be harmful or not.
  • Example: python2.7 peepdf.py file_name

Oletools

  • oletools – python tools to analyze MS OLE2 files (Structured Storage, Compound File Binary Format) and MS Office documents, for malware analysis, forensics, and debugging.
  • olevba is a script to parse OLE and OpenXML files such as MS Office documents (e.g. Word, Excel), to detect VBA Macros, extract their source code in clear text, and detect security-related patterns such as auto-executable macros, suspicious VBA keywords used by malware, anti-sandboxing, and anti-virtualization techniques, and potential IOCs (IP addresses, URLs, executable filenames, etc).
  • Example: olevba file_name
  • oleobj is a Python script and module to parse OLE objects and files stored into various MS Office file formats (doc, xls, ppt, docx, xlsx, pptx, etc)
  • Example: oleobj file_name

ExifTool

  • ExifTool is a platform-independent Perl library plus a command-line application for reading, writing, and editing meta information in a wide variety of files.

Wireshark

  • Wireshark is the world’s foremost and widely-used network protocol analyzer. It lets you see what’s happening on your network at a microscopic level and is the de facto (and often de jure) standard across many commercial and non-profit enterprises, government agencies, and educational institutions.

URLscan

urlscan.io – Website scanner for suspicious and malicious URLs.

MXtoolBox

MxToolbox supports global Internet operations by providing free, fast, and accurate network diagnostic and lookup tools. Millions of technology professionals use our tools to help diagnose and resolve a wide range of infrastructure issues.

Example 01 – Static Analysis

Note: All tests were executed in a virtual machine with Linux operating system.

Here I’m going to show in practice how we can use some of the tools above to analyze a malicious file.

We start with ExifTool to try to gather information through metadata.

Attention points:

  • In the figure above we can identify the name of who made the last modification of the file. (possible attacker name).
  • An alleged creator name (username used to create the file).
  • In the title, it is possible to identify something as if it were the execution of a file or command, but written in reverse.

When I use the rev command to reverse the output of the ExifTool command it is possible to better understand the line, as shown below.

Using the olevba it’s possible to identify malicious macros and their possible actions.

Attention point:

  • May open a file
  • May write to a file (if combined with Open)
  • May run an executable file or a system command
  • May call a DLL using Excel 4 Macros (XLM/XLF)
  • May create an OLE object
  • May attempt to obfuscate specific strings
  • May run an executable file or a system command using Excel 4 Macros (XLM/XLF)
  • Base64-encoded strings were detected, which may be to obfuscate strings

Using the PEframe it’s possible to get a similar result but without the suspicious points shown by olevba.

Now performing dynamic analysis, I opened the file using the LibreOffice package, and the same generated an alert that the macros can contain viruses.

The content of the file induces the user to enable the “enable edition” option.

To according shown above, with some small steps was possible to perform an analysis and have a conclusion that the file is malicious.

See you in the next analysis 🙂

About the author: Zoziel Pinto Freire

Cyber Security Specialist | Forensic Expert | Threat Hunter | BlueTeam | RedTeam | Pentester | Assessment

Follow me on Twitter: @securityaffairs and Facebook

[adrotate banner=”9″][adrotate banner=”12″]

Pierluigi Paganini

(SecurityAffairs – hacking, Malicious file analysis)

[adrotate banner=”5″]

[adrotate banner=”13″]

Pierluigi Paganini

Pierluigi Paganini is member of the ENISA (European Union Agency for Network and Information Security) Threat Landscape Stakeholder Group and Cyber G7 Group, he is also a Security Evangelist, Security Analyst and Freelance Writer. Editor-in-Chief at "Cyber Defense Magazine", Pierluigi is a cyber security expert with over 20 years experience in the field, he is Certified Ethical Hacker at EC Council in London. The passion for writing and a strong belief that security is founded on sharing and awareness led Pierluigi to find the security blog "Security Affairs" recently named a Top National Security Resource for US. Pierluigi is a member of the "The Hacker News" team and he is a writer for some major publications in the field such as Cyber War Zone, ICTTF, Infosec Island, Infosec Institute, The Hacker News Magazine and for many other Security magazines. Author of the Books "The Deep Dark Web" and “Digital Virtual Currency and Bitcoin”.

Recent Posts

Fintech firm Figure disclosed data breach after employee phishing attack

Fintech firm Figure confirmed a data breach after hackers used social engineering to trick an…

17 hours ago

U.S. CISA adds a flaw in BeyondTrust RS and PRA to its Known Exploited Vulnerabilities catalog

The U.S. Cybersecurity and Infrastructure Security Agency (CISA) adds a flaw in BeyondTrust RS and…

19 hours ago

Suspected Russian hackers deploy CANFAIL malware against Ukraine

A new alleged Russia-linked APT group targeted Ukrainian defense, government, and energy groups, with CANFAIL…

24 hours ago

New threat actor UAT-9921 deploys VoidLink against enterprise sectors

A new threat actor, UAT-9921, uses the modular VoidLink framework to target technology and financial…

2 days ago

Attackers exploit BeyondTrust CVE-2026-1731 within hours of PoC release

Attackers quickly targeted BeyondTrust flaw CVE-2026-1731 after a PoC was released, enabling unauthenticated remote code…

2 days ago

Google: state-backed hackers exploit Gemini AI for cyber recon and attacks

Google says nation-state actors used Gemini AI for reconnaissance and attack support in cyber operations.…

2 days ago

This website uses cookies.