Back to skill

Security audit

pdftk Server

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward PDF command-reference skill with some security caveats, but I found no hidden, deceptive, or purpose-mismatched behavior.

Install only if you are comfortable using PDFtk on local PDFs. Avoid putting real PDF passwords directly in shell commands, treat decrypted files and extracted attachments as sensitive, prefer modern encryption tools for confidential documents, and verify any source archive before building it.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:80
Finding
PDF Passwords Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:80-92`; `references/pdftk-cli-examples.md:20-44`, `references/pdftk-cli-examples.md:90-94`, and `references/pdftk-cli-examples.md:120-124`; `references/pdftk-man-page.md:34-37` **Vulnerability Type**: Sensitive information exposure through process arguments and shell history **Risk Level**: Medium ### Vulnerable Code ```bash # SKILL.md:80-84 # Set an owner password and a user password with 128-bit encryption (default): pdftk input.pdf output secured.pdf owner_pw mypassword user_pw userpass ``` ```bash # SKILL.md:88-92 # Remove encryption using the known password: pdftk secured.pdf input_pw mypassword output unsecured.pdf ``` ```bash # references/pdftk-cli-examples.md:20-44 pdftk secured.pdf input_pw foopass output unsecured.pdf pdftk 1.pdf output 1.128.pdf owner_pw foopass pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing ``` ```bash # references/pdftk-cli-examples.md:90-94 pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf ``` ```bash # references/pdftk-cli-examples.md:120-124 pdftk in.pdf burst owner_pw foopass allow DegradedPrinting ``` ```bash # references/pdftk-man-page.md:34-37 pdftk A=secured.pdf input_pw A=foopass cat output unsecured.pdf ``` ### Technical Analysis The documented workflows place PDF owner passwords, user passwords, and decryption passwords directly in command-line arguments. Although the examples use placeholders, users are expected to replace them with real secrets. Command-line secrets can be exposed through: - Shell history files and terminal session logs. - Process inspection utilities while PDFtk is running. - System monitoring, auditing, telemetry, or job-execution logs that record complete command lines. - CI/CD logs or automation output if the examples are incorporated into scripts. - Shared terminal history or diagnostic bundles. This is a local information-disclosure ...[truncated 1145 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer PDFtk's interactive `PROMPT` mechanism where the installed PDFtk variant supports it, so passwords are not included in the command line. 2. Add a prominent warning that real passwords must not be placed directly in shell commands, scripts, CI configuration, or terminal transcripts. 3. If command-line password arguments are unavoidable: - Temporarily disable shell history before running the command. - Ensure history is restored afterward. - Run the operation only on a trusted, single-user system. - Prevent automation and monitoring systems from logging the complete command line. 4. Avoid storing passwords in plaintext environment variables, as these may also be observable in process environments or logs. 5. Recommend unique, randomly generated PDF passwords to reduce the effect of disclosure or reuse. 6. Replace all examples containing password-like literals with interactive examples and clearly mark any argument-based form as a compatibility fallback with security limitations. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/pdftk-cli-examples.md:80
Finding
Obsolete RC4 Encryption Presented as a Document-Protection Workflow<![CDATA[ ## Vulnerability Details **File Location**: `references/pdftk-cli-examples.md:80-86`; `references/pdftk-man-page.md:191-194` **Vulnerability Type**: Use of obsolete and cryptographically weak PDF encryption **Risk Level**: Medium ### Vulnerable Code ```bash # references/pdftk-cli-examples.md:80-86 ## Apply 40-Bit Encryption Merge and encrypt with 40-bit strength: pdftk 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass ``` ```markdown <!-- references/pdftk-man-page.md:191-194 --> | `encrypt_40bit` | Apply 40-bit RC4 encryption | | `encrypt_128bit` | Apply 128-bit RC4 encryption (default when password set) | ``` ### Technical Analysis The documentation presents 40-bit RC4 as an available encryption workflow without clearly warning that it is obsolete and unsuitable for protecting sensitive information. A 40-bit key space is within practical brute-force range, and RC4 is a deprecated cipher with well-established weaknesses. The manual also identifies the 128-bit mode as RC4. While stronger than the 40-bit mode in key length, RC4-based PDF encryption remains a legacy choice and should not be represented as modern protection for confidential documents. PDF permission flags and owner-password restrictions should also not be treated as strong access-control boundaries. Their enforcement depends on PDF readers, and compliant or noncompliant software may ignore document restrictions after decryption. ### Attack Path 1. A user follows the documented `encrypt_40bit` example to protect a confidential PDF. 2. The encrypted PDF is shared, intercepted, leaked, or otherwise acquired by an attacker. 3. The attacker applies password guessing, brute-force tooling, or legacy PDF password-recovery techniques against the weak encryption. 4. The attacker recovers access to the PDF contents or removes its document restrictions. 5. The attacker reads, copies, modifies, or redistributes information that the user believed was securely protected. ### Impact ...[truncated 444 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the 40-bit RC4 workflow from recommended examples. 2. Clearly label both 40-bit and 128-bit RC4 modes as legacy mechanisms that are inappropriate for sensitive or regulated data. 3. Recommend a maintained PDF utility that supports modern AES-based PDF encryption when confidentiality is required. 4. Explain that PDF permission flags are not a substitute for encryption or external access control. 5. Add guidance to: - Use long, unique, randomly generated passwords. - Transmit passwords through a channel separate from the PDF. - Avoid password reuse. - Verify the encryption algorithm and PDF security revision after creating the output. 6. Retain legacy syntax only in a compatibility appendix, accompanied by an explicit warning and migration guidance. ]]>

T08 · Insecure Dependencies

Note
Location
references/download.md:55
Finding
Downloaded Source Archive Is Built Without Cryptographic Integrity Verification<![CDATA[ ## Vulnerability Details **File Location**: `references/download.md:55-70` **Vulnerability Type**: Unverified third-party source download and build **Risk Level**: Low ### Vulnerable Code ```bash # references/download.md:55-70 Download and unpack the source: curl -LO https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip unzip pdftk-2.02-src.zip Review the pdftk license information in: license_gpl_pdftk/readme.txt Change into the pdftk sub-directory and run: cd pdftk make -f Makefile.Debian ``` ### Technical Analysis The workflow downloads a source archive over HTTPS and subsequently invokes a Makefile from its extracted contents. It does not require verification of a cryptographic checksum, signed release manifest, or detached signature before extraction and build. HTTPS protects the connection in transit but does not independently prove that the retrieved release artifact is the expected immutable file. If the vendor server, hosting account, DNS or certificate infrastructure, or release artifact is compromised, a modified archive could contain attacker-controlled Makefile directives or source code. The documented command is not a direct remote shell pipeline, and the apparent source is the official vendor domain, which reduces likelihood. Nevertheless, invoking build logic from an unverified archive creates a supply-chain exposure. ### Attack Path 1. An attacker compromises the hosted archive, vendor release infrastructure, or another trusted component in the delivery path. 2. The attacker replaces the ZIP archive with a modified version containing malicious Makefile commands or source code. 3. A user follows the documentation and downloads the modified archive. 4. Because no checksum or signature is checked, the altered file is accepted and extracted. 5. The user runs `make -f Makefile.Debian`. 6. The attacker's build commands execute with the privileges of the user running `make`. 7. The malicious build may access that u ...[truncated 715 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Provide an official SHA-256 or stronger digest for the exact release archive. 2. Require checksum verification before extraction, for example: ```bash curl -LO https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip printf '%s %s\n' 'EXPECTED_SHA256' 'pdftk-2.02-src.zip' | sha256sum --check - unzip pdftk-2.02-src.zip ``` 3. Prefer a detached signature or signed release manifest and document verification against a pinned, independently obtained maintainer key. 4. Stop the workflow immediately if verification fails. 5. Prefer authenticated and maintained operating-system packages where practical. 6. Advise users to inspect build files and run builds as an unprivileged account. 7. Explicitly warn users not to invoke `make` or other build steps with `sudo` unless a separately reviewed installation step strictly requires elevated privileges. 8. Pin the version, download URL, checksum, and signing identity together so a changed remote artifact cannot be silently accepted. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (10)

Ae1

High
Category
analysis-evasion
Content
- [pdftk-man-page.md](references/pdftk-man-page.md) - Complete manual reference with all operations, options, and syntax
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Missing User Warnings

Medium
Confidence
88% confidence
Finding
This markdown skill description includes privacy-impacting behaviors such as decrypting PDFs and extracting embedded files, but it does not warn users that these actions may reveal protected content or recover sensitive attachments onto disk. Under the markdown criteria for missing user warnings, descriptions should disclose behaviors that could affect user data or privacy.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
- PDFtk Server must be installed on the system
  - **Windows**: `winget install --id PDFLabs.PDFtk.Server`
  - **macOS**: `brew install pdftk-java`
  - **Linux (Debian/Ubuntu)**: `sudo apt-get install pdftk`
  - **Linux (Red Hat/Fedora)**: `sudo dnf install pdftk`
- Access to a terminal or command prompt
- Verify installation by running `pdftk --version`
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
- PDFtk Server must be installed on the system
  - **Windows**: `winget install --id PDFLabs.PDFtk.Server`
  - **macOS**: `brew install pdftk-java`
  - **Linux (Debian/Ubuntu)**: `sudo apt-get install pdftk`
  - **Linux (Red Hat/Fedora)**: `sudo dnf install pdftk`
- Access to a terminal or command prompt
- Verify installation by running `pdftk --version`
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
On Debian/Ubuntu-based distributions:

```bash
sudo apt-get install pdftk
```

On Red Hat/Fedora-based distributions:
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
On Debian/Ubuntu-based distributions:

```bash
sudo apt-get install pdftk
```

On Red Hat/Fedora-based distributions:
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Missing User Warnings

Medium
Confidence
86% confidence
Finding
This markdown file includes commands to remove PDF encryption and later to extract embedded attachments, both of which can affect protected content and expose user data. The examples present these operations as straightforward commands without any warning about authorization, sensitivity of decrypted files, or risks from unpacking embedded files.

Missing User Warnings

Low
Confidence
79% confidence
Finding
This file is markdown, so SQP-2 applies to descriptions that omit warnings about behaviors affecting user data or privacy. The `unpack_files` example explicitly extracts embedded files to disk, and nearby sections also describe exporting metadata, but the document provides no caution that these outputs may contain sensitive information from the source PDF.

Excessive Permissions

Low
Category
Privilege Escalation
Content
| `ScreenReaders` | Allow screen reader access |
| `ModifyAnnotations` | Allow annotation modification |
| `FillIn` | Allow form fill-in |
| `AllFeatures` | Grant all permissions |

## Key Notes
Confidence
75% confidence
Finding
Skill requests more permissions than appear necessary for its stated functionality. Review if elevated access is justified.

Scope Creep

Low
Category
Excessive Agency
Content
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Download the Bouncy Castle source code from: http://www.bouncycastle.org/.
Confidence
70% confidence
Finding
Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Static analysis

No suspicious patterns detected.