How to Check a PDF for Hidden JavaScript & Malware in Your Browser (Zero-Upload Guide)
Whether you run a cyber cafe downloading customer admit cards from unknown links or you received an unexpected tax invoice over email, opening a weaponized PDF can trigger silent scripts or redirect you to credential-harvesting pages. Worse, uploading confidential Aadhaar, PAN, or bank statement PDFs to public cloud virus scanners leaks your private data to third-party servers. Here is how PDF threat markers work and how to inspect raw bytes locally in your browser.
Direct Answer: How Do You Check a PDF for Hidden JavaScript Without Uploading It?
Use a client-side binary inspector like LoomPDF PDF Security Scanner. It reads the file inside local browser memory, verifies the genuine %PDF- magic header (0x25 0x50 0x44 0x46), blocks disguised executables (MZ, ELF, PK) and double extensions, and flags dangerous PDF dictionary tokens such as /JavaScript, /JS, /OpenAction, /Launch, and /URI—with zero bytes sent to any server.
Inspect Suspect PDFs Locally in 1 Second
Checks %PDF- magic bytes, /JavaScript, /OpenAction, /Launch & double-extension spoofing 100% offline.
1. PDF Threat Marker Reference Table
A PDF is not a flat image—it is an object-oriented container. Legitimate government forms rarely need active scripting, whereas malicious payloads rely on specific PDF dictionary keys to execute code or phone home:
| PDF Marker / Header | What It Means Technically | Risk Level | Common Attack Vector |
|---|---|---|---|
| /JavaScript & /JS | Embedded Acrobat JavaScript stream inside PDF objects | High | Heap-spray exploits, silent form scraping, obfuscated payloads |
| /OpenAction & /AA | Auto-trigger executed the instant the PDF opens | High | Zero-click execution of embedded scripts without user consent |
| /Launch | Requests the OS to spawn an external command or binary | Critical | Spawning cmd.exe, PowerShell, or bundled payloads |
| /URI & /SubmitForm | Outbound HTTP/HTTPS hyperlink or form-data POST action | Medium | Phishing portals, NTLM hash leaks, silent IP tracking |
| Disguised Magic Bytes | Missing %PDF-; starts with MZ, ELF, or PK |
Critical | Double-extension trojans like admit_card.exe.pdf |
2. Why Cloud Virus Scanners Leak Confidential Indian Documents
When you upload a PDF to a remote online scanner, the full binary—including your Aadhaar number, QR code, bank account digits, or home address—is transmitted over the network and stored on third-party infrastructure. Many public scanning platforms even make submitted samples downloadable by paid researchers.
By contrast, LoomPDF's pre-flight security engine (fileSecurityScanner.ts) and PDF Security Scanner run 100% inside your browser's JavaScript sandbox. It inspects the first 2 KB for binary magic headers (blocking Windows MZ executables, Linux/Android ELF binaries, PK archives, and #! shell scripts), rejects dangerous double-extensions (.exe.jpg, .php.png, .svg), enforces memory-safe pixel bounds (10,000×10,000 px / 60 MP) against decompression bombs, and strips GPS/EXIF metadata from JPEGs—all offline.
3. Step-by-Step: Inspect & Clean Suspect PDFs Safely
- Pre-Scan Before Opening: Drag any downloaded PDF into LoomPDF PDF Security Scanner before double-clicking it in Adobe Reader or Foxit.
- Verify Magic Header & Script Flags: Confirm the file starts with
%PDF-and check whether/JavaScript,/OpenAction, or/Launchtriggers are present. - Strip Unnecessary Pages: If a multi-page PDF contains suspicious cover sheets or bloated attachments, use LoomPDF Remove Pages to extract only the pages you need locally.
- Re-Compress for Portal Upload: Need the verified document under 100 KB or 200 KB? Pass it to LoomPDF Resize Image & PDF for strict client-side KB targeting.
Frequently Asked Questions
Can a PDF file contain executable JavaScript or malware?
Yes. PDFs support embedded /JavaScript and /JS streams, /OpenAction auto-triggers, /Launch commands, and /URI redirects that can execute or phish users when opened.
Why should I avoid uploading bank statements or Aadhaar PDFs to online virus scanners?
Cloud scanners upload your raw document to remote servers where sensitive KYC data may be retained or exposed. A browser-based scanner inspects the file locally with zero network transmission.
How does magic byte inspection catch disguised malware?
Legitimate PDFs always start with %PDF- (hex 25 50 44 46). Checking the first 2 KB immediately exposes disguised Windows executables (MZ), Linux binaries (ELF), or archives (PK).
Does LoomPDF PDF Security Scanner upload my files to any server?
No. All filename, magic-byte, and PDF structure checks execute 100% inside your browser's local memory.