From d53fd5c63c58ea00b8249b3ce2dc95315ea624e1 Mon Sep 17 00:00:00 2001
From: cyfraeviolae
+ After reviewing the collisions below for JPEG/BMP files and PDF/PDF files, the reader is encouraged to try + to construct an attack for a different pair of file formats. +
First, we will describe a general strategy to create a ciphertext that yields the same MAC @@ -209,8 +213,9 @@ go build -o /tmp/decrypt-aes-gcm /tmp/decrypt-aes-gcm.go
%PDF-1.7 %µ¶- The header is followed by a sequence of objects. A simple object containing a stream is shown below, with the data - for the object inserted at
[DATA]
.
+ The header is followed by a sequence of objects. A simple object
+ with id 1 0
containing a stream is shown below, with
+ the data for the stream inserted at [DATA]
.
1 0 obj <<>> @@ -218,15 +223,15 @@ go build -o /tmp/decrypt-aes-gcm /tmp/decrypt-aes-gcm.go [DATA] endstream endobj- At the end of the file, an
xref
table determines how the objects are layed out in space,
- and finally, the file ends with the line %%EOF
, after which no more bytes are read by the PDF parser.
+ At the end of the file, an xref
table summarizes the byte offsets of each object in the file.
+ The file ends with the line %%EOF
.
- Our strategy will be to place a new stream object at the beginning of the first PDF file. This object
- will include the entirety of the second PDF file. Because the
- xref
table does not reference this new object, the
- first PDF will not attempt to render the additional data.
-
Fix an arbitrary nonce \(n\) and key \(k_1\). We need our ciphertext header \(c_H\) to decrypt to the following
plaintext \(m_H\) under \(k_1\). We choose the object ID 0 0
@@ -399,10 +404,10 @@ go build -o /tmp/decrypt-aes-gcm /tmp/decrypt-aes-gcm.go
- Show me the code.
+ Example with code.
-from aesgcmanalysis import att_merge_jpg_bmp
+from aesgcmanalysis import att_merge_jpg_bmp, att_merge_pdf_pdf
with open('first.jpg', 'rb') as h:
jpg = h.read()
--
cgit v1.2.3