Cracking a Password-Protected PDF File

Learn to brute-force a password-protected PDF file using the Pikepdf Python library.

Introduction

Password-protected PDF documents can be cracked with little effort. Surfing the web unveils countless applications for PDFs password removal.

Common applications like DrPDF, GuaPDF, PDFCrack or ElcomSoft can be used to unlock secured PDF documents. However, these applications are mostly paid, or in certain circumstances, may disclose the PDF document confidential information.

Methods for PDF password recovery

A user password can be broken either with a dictionary attack, or a brute force attack. Let’s describe these two modes:

  • Dictionary attack: It is a variant of the brute force technique, except that attackers go through a list of common words and sentences. Numerous users continue to utilize reusable, standard passwords to protect their PDF files. Maintaining sensitive information in PDF documents with reusable or standard passwords is extremely risky, because such passwords can be easily hacked or guessed. For example, one of the most popular passwords is “123456.”

  • Brute force attack: This technique uses the trial-and-error mechanism in order to guess the password. Hackers tackle every possible combination, expecting to guess the correct password.

Scope

This lesson is oriented to exemplify the mechanism of unlocking a password-protected PDF file while adopting a brute force technique, using a utility developed in the Python programming language.

Get hands-on with 1200+ tech skills courses.