Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 3 min read

C2PA Binary Content Authenticity (JUMBF, PNG caBX & JPEG APP11) Inspection in Zero-Upload Browser RAM

Verifying C2PA (Coalition for Content Provenance and Authenticity) metadata should never require uploading sensitive raw photographs, legal screenshots, or unreleased video frames to a third-party server. Every modern br

Verifying C2PA (Coalition for Content Provenance and Authenticity) metadata should never require uploading sensitive raw photographs, legal screenshots, or unreleased video frames to a third-party server. Every modern browser can read File bytes into a local Uint8Array, compute SHA-256 via W3C SubtleCrypto, and walk container boxes strictly in RAM (0 bytes uploaded).

This article documents the container byte layout defined in https://nandai.org/.well-known/c2pa-content-authenticity-spec.json (8,189 B) and implemented in the zero-upload browser suite at https://nandai.org/tools and https://nandai.org/tools/watermark-inspector.

1. Binary Container Offsets for C2PA & ISO 19566-5 JUMBF

Across image and video formats, C2PA stores its JUMBF (jumb / jumd) superbox at format-specific binary headers:

Media Container Provenance Marker / Box Binary Header Layout Integrity Verification
PNG (ISO/IEC 15948) caBX chunk 4B len (BE) + "caBX" + payload + 4B CRC-32 Verify IEEE CRC-32 over b"caBX" + payload
JPEG (ISO/IEC 19566-5) APP11 (0xFFEB) FF EB + 2B len + "JP" + 2B En + 4B Z + JUMBF Match "JP" + c2pa JUMBF UUID / label
ISOBMFF / MP4 / MOV uuid box 4B size + "uuid" + d8fec3d6-1b0e-483c-9297-5828877ec481 Walk top-level + meta / moov box lengths
WebP (RIFF) C2PA chunk "RIFF" + 4B size + "WEBP" + "C2PA" Verify chunk size alignment (even pad)

2. Zero-Dependency Python C2PA Binary Header Scanner

The same byte-walking logic that runs inside browser ArrayBuffer memory runs cleanly in Python stdlib for CI verification pipelines:

#!/usr/bin/env python3
"""Zero-dependency PNG caBX, JPEG APP11 & MP4 C2PA UUID binary scanner."""
import hashlib
import struct
import zlib

MP4_C2PA_UUID = bytes.fromhex("d8fec3d61b0e483c92975828877ec481")


def scan_c2pa_bytes(data: bytes) -> dict:
    sha256 = hashlib.sha256(data).hexdigest()
    boxes = []
    if data.startswith(b"\x89PNG\r\n\x1a\n"):
        pos = 8
        while pos + 12 <= len(data):
            length = struct.unpack(">I", data[pos:pos + 4])[0]
            ctype = data[pos + 4:pos + 8]
            payload = data[pos + 8:pos + 8 + length]
            crc_read = struct.unpack(">I", data[pos + 8 + length:pos + 12 + length])[0]
            crc_ok = (zlib.crc32(ctype + payload) & 0xFFFFFFFF) == crc_read
            if ctype == b"caBX":
                boxes.append({"type": "caBX", "offset": pos, "length": length, "crc_valid": crc_ok})
            pos += 12 + length
            if ctype == b"IEND":
                break
    elif data.startswith(b"\xff\xd8"):
        pos = 2
        while pos + 4 <= len(data) and data[pos] == 0xFF:
            marker = data[pos:pos + 2]
            if marker == b"\xff\xda":
                break
            seg_len = struct.unpack(">H", data[pos + 2:pos + 4])[0]
            if marker == b"\xff\xeb" and data[pos + 4:pos + 6] == b"JP":
                boxes.append({"type": "APP11_JP", "offset": pos, "length": seg_len})
            pos += 2 + seg_len
    elif len(data) >= 12 and data[4:8] == b"ftyp":
        pos = 0
        while pos + 8 <= len(data):
            size = struct.unpack(">I", data[pos:pos + 4])[0]
            btype = data[pos + 4:pos + 8]
            if size < 8:
                break
            if btype == b"uuid" and data[pos + 8:pos + 24] == MP4_C2PA_UUID:
                boxes.append({"type": "ISOBMFF_UUID", "offset": pos, "length": size})
            pos += size
    return {"sha256": sha256, "c2pa_detected": bool(boxes), "boxes": boxes, "bytes_uploaded": 0}

3. Verified Local Stdio MCP Output vs. Remote 4-Ring Sandbox

In the MIT destiny_mcp_server.py (108 tools, https://nandai.org/releases/destiny-verify-2.0.0.tar.gz), Tools #6 (inspect_c2pa_or_sha256) and #13 (inspect_c2pa_provenance_boxes) enforce a strict 4-ring filesystem boundary:

  • Public HTTP MCP (https://nandai.org/api/mcp): Passing a local file_path intentionally fails closed with HTTP 403 (sandbox_blocked: true) so remote callers cannot probe server paths.
  • Local Stdio MCP (python3 mcp/destiny_mcp_server.py): Tested on a 122-byte PNG containing an embedded caBX JUMBF chunk (SHA-256: 04732d35befdb1ea9dc5a9316ae85a1f40c98838425928d79ead4cdd75db04f9), inspect_c2pa_provenance_boxes reports:
{
  "ok": true,
  "byte_length": 122,
  "container_format": "PNG (ISO/IEC 15948)",
  "c2pa_detected": true,
  "c2pa_corrupted": false,
  "provenance_status": "C2PA_JUMBF_PROVENANCE_PRESENT",
  "c2pa_box_count": 1,
  "c2pa_boxes": [
    {
      "type": "caBX",
      "offset": 33,
      "length": 41,
      "crc_valid": true
    }
  ],
  "bytes_uploaded": 0
}

For quick visual checks without cloning any repo, drop any .png, .jpg, .webp, or .mp4 directly into https://nandai.org/tools/watermark-inspector or the full 12-tool client-side workbench at https://nandai.org/tools and confirm 0 outbound network bytes in DevTools.

Verified Engineering Resources

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.