Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Vulnerabilities

Lossy Image Compression Can Hide Malicious Code in PDF Files: Researcher

A researcher has demonstrated that lossy image compressors can be used to hide arbitrary code inside PDF documents. The method could be highly efficient for malicious actors because security products are designed to ignore such data.

A researcher has demonstrated that lossy image compressors can be used to hide arbitrary code inside PDF documents. The method could be highly efficient for malicious actors because security products are designed to ignore such data.

It’s not uncommon for cybercriminals to hide malicious code in PDF files. The malicious code is usually designed to exploit vulnerabilities in the application that is used to open the document, in most cases Adobe Reader.

Exploits can be hidden inside PDF files by using data compressors, such as Lempel–Ziv–Welch (LZW) and Deflate, and even image compressors, such as CCITTFaxDecode and JBIG2Decode. Security products are designed to scan PDF files for payloads compressed using these algorithms.

On the other hand, antiviruses and PDF forensic tools usually ignore data compressed with lossy compressors such as JPXDecode and DCTDecode. Lossy compression uses inexact approximations for representing the encoded content, which leads to a certain amount of information being discarded.

Lossy compression is efficient for images, but not for code, which is why security solutions assume that lossily compressed data can’t contain malicious code.

However, CSIS researcher Dénes Óvári has demonstrated that hiding malicious code in a JPEG image compressed with the DCTDecode lossy compressor is possible. The experts has determined that while encoding a color JPEG image would result in data loss that would lead to corrupted code, a high-quality grayscale JPEG image could do the trick.

Óvári has developed a proof-of-concept where he encoded a piece of JavaScript code as a grayscale image and embedded it in a PDF document. The image was inserted into an Image object filtered with DCTDecode, that was then referenced by a JavaScript action entry. This ensures that the code is executed when the PDF file is opened.

“Although this is not a security breach in itself (an exploit still needs to be used inside the stream for malicious activity), the fact that the usage of DCTDecode for this purpose has seemingly been ruled out by the industry means that even known threats could be hidden in this way from anti-virus scanners and/or researchers,” Óvári wrote in a research paper published on Virus Bulletin.

Advertisement. Scroll to continue reading.

“In order to provide users with maximum protection, the DCTDecode stream must no longer be overlooked: in PDF reader implementations, the referencing of uncompressed image data as parameters from objects expecting binary data should be prohibited. We should also perhaps re-examine the handling of other file formats in which data in JPEG format is assumed always to be lossily compressed, while a greyscale mode is still available,” the expert added.

Written By

Eduard Kovacs (@EduardKovacs) is a managing editor at SecurityWeek. He worked as a high school IT teacher for two years before starting a career in journalism as Softpedia’s security news reporter. Eduard holds a bachelor’s degree in industrial informatics and a master’s degree in computer techniques applied in electrical engineering.

Click to comment

Trending

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Join the session as we discuss the challenges and best practices for cybersecurity leaders managing cloud identities.

Register

SecurityWeek’s Ransomware Resilience and Recovery Summit helps businesses to plan, prepare, and recover from a ransomware incident.

Register

Expert Insights

Related Content

Vulnerabilities

Less than a week after announcing that it would suspended service indefinitely due to a conflict with an (at the time) unnamed security researcher...

Data Breaches

OpenAI has confirmed a ChatGPT data breach on the same day a security firm reported seeing the use of a component affected by an...

IoT Security

A group of seven security researchers have discovered numerous vulnerabilities in vehicles from 16 car makers, including bugs that allowed them to control car...

Vulnerabilities

A researcher at IOActive discovered that home security systems from SimpliSafe are plagued by a vulnerability that allows tech savvy burglars to remotely disable...

Risk Management

The supply chain threat is directly linked to attack surface management, but the supply chain must be known and understood before it can be...

Cybercrime

Patch Tuesday: Microsoft calls attention to a series of zero-day remote code execution attacks hitting its Office productivity suite.

Vulnerabilities

Patch Tuesday: Microsoft warns vulnerability (CVE-2023-23397) could lead to exploitation before an email is viewed in the Preview Pane.

Vulnerabilities

The latest Chrome update brings patches for eight vulnerabilities, including seven reported by external researchers.