mozilla / mozilla/pdf.js

[Bug]: indicate modifications after digital signature

Open
#21,698 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

digital-signatures
Dominant language
JavaScript
Stars
53.9k
Forks
10.7k
Avg merge
18h 38m
Merged PRs (30d)
130

Description

Attach (recommended) or Link to PDF file
Web browser and its version

Firefox Nigthly 155a

Operating system and its version

Windows 11

PDF.js version

the one that comes with that nightly.

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem
  1. Digitally sign a document with a testing certificate ( signed.pdf was signed with pdfsig from poppler).[^pdfsig]

    Digital signature is considered valid (as verified).

    Image
  2. Modify the text field with Acrobat Reader and save the results (modifications are saved as incremental updates).

    Digital signature is considered valid, with no further indication that the document has been modified after the signature:

    Image

[^pdfsig]: pdfsig always signs PDF documents adding an incremental update (this is why modified-signed.pdf contains three %%EOF strings).

What is the expected behavior?

Signature verification should indicate that the document contains unsigned modifications.

This is essential with fill-in forms, since giving no indication that the document has been modified after being digitally signed may be give the misleading information that the modifications have been accepted by the original signer.

What went wrong?

Valid signature with an added incremental update neither renders the signature invalid or

Compare the original signature info (using pdfsig from poppler-26.08.0):

$ pdfcurrentsig signed.pdf 
Digital Signature Info of: signed.pdf
Signature #1:
  - Signature Field Name: x
  - Signer Certificate Common Name: Testing Certificate [RSA 4096])
  - Signer full Distinguished Name: CN=Testing Certificate [RSA 4096])
  - Signing Time: Aug 03 2026 13:37:10
  - Signing Hash Algorithm: SHA-256
  - Signature Type: adbe.pkcs7.detached
  - Signed Ranges: [0 - 5646], [25648 - 25993]
  - Total document signed
  - Signature Validation: Signature is Valid.
  - Certificate Validation: Unknown issue with Certificate or corrupted data.

With the modified document after the signature:

$ pdfcurrentsig modified-signed.pdf
Digital Signature Info of: modified-signed.pdf
Signature #1:
  - Signature Field Name: x
  - Signer Certificate Common Name: Testing Certificate [RSA 4096])
  - Signer full Distinguished Name: CN=Testing Certificate [RSA 4096])
  - Signing Time: Aug 03 2026 13:37:10
  - Signing Hash Algorithm: SHA-256
  - Signature Type: adbe.pkcs7.detached
  - Signed Ranges: [0 - 5646], [25648 - 25993]
  - Not total document signed
  - Signature Validation: Signature is Valid.
  - Certificate Validation: Unknown issue with Certificate or corrupted data.
Link to a viewer

No response

Additional context

If electronic signatures are legally valid in EU/EEA Member States (article 25.2 of Regulation EU/910/2014), it is essential to know whether an electronically signed PDF document has been modified after being signed: signed contents are legally binding, but modifications after signing are ways to forge electronic documents and forgeries aren’t legally binding (when properly detected).

Again, first of all, users should be given hints that signed documents have been modified after being signed.

@beurdouche, congratulations for the implementation and many thanks for your excellent work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the attached signed.pdf and modified-signed.pdf through PDF.js's digital-signature verification entry point, using the pdfsig output to understand the signed ranges and the added incremental update. Done means the modified document clearly indicates unsigned post-signature changes while the original signed document remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.