├── readme.txt
├── dec_sdata.c
├── pixma_decrypt.c
└── pixma_unpack.c
/readme.txt:
--------------------------------------------------------------------------------
1 | What is this?
2 | -------------
3 | Some little tools to unpack firmware of Canon PIXMA series for analysis.
4 |
5 | Motivation
6 | ----------
7 | Some Pixma printer is unable to reset the Waste Ink counter and refuses to print now,
8 | even though waste ink container has been swapped out.
9 | So I was curious about the inner workings of the firmware to find a clue on how to
10 | reset the counter.
11 | But I soon gave up on it. Nevertheless, it has been interesting and maybe this is
12 | useful for other researchers? Basically, I just implemented what has been described at
13 | https://www.contextis.com/en/blog/hacking-canon-pixma-printers-doomed-encryption
14 |
15 | How to use?
16 | -----------
17 | 1) Download firmware
18 | Check the USB device ID of the Pixma printer, i.e. 04a9:1769
19 | Then downlod the firmware by placing the device ID instead of 1769 in the following command:
20 |
21 | wget `wget -O - -o /dev/null http://gdlp01.c-wss.com/rmds/ij/ijd/ijdupdate/1769.xml | sed -n 's:.*\(.*\).*:\1:p'`
22 |
23 | 2) Now decrypt firmware, and decode SREC file to binary
24 | You need srec_cat from srecord tools for this, i.e. srecord-1.64: http://srecord.sourceforge.net/
25 |
26 | ./pixma_decrypt 1769V1100AN.bin decoded.asc
27 | grep -v -e '^SF' decoded.asc | srec_cat -o decoded.bin -binary
28 |
29 | 3) Now you can try to unpack the payload:
30 | ./pixma_unpack decoded.bin firmware.bin
31 |
32 |
33 | Decrypt sdata.bin
34 | -----------------
35 | If you want to decrypt certificate data (for whatever reason you want to do this...
36 | It's just a certificate list for trusted CAs, so no idea why this even has been "crypted"):
37 |
38 | wget http://dtv-p.c-ij.com/sdata/struct01/sdata.bin
39 | ./dec_sdata sdata.bin sdata.dec
40 |
41 |
--------------------------------------------------------------------------------
/dec_sdata.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "dec_sdata.h"
4 |
5 | #define TBL_SZ 0x10000
6 |
7 | /* Decrypts the public certificate list at http://dtv-p.c-ij.com/sdata/struct01/sdata.bin
8 | * (versioned by http://dtv-p.c-ij.com/sdata/struct01/version.bin )
9 | */
10 |
11 | void decode_sdata(unsigned char *in)
12 | {
13 | int j, k;
14 |
15 | for (j=0, k=0; j