pajowu / signal-backup-decode

Decode Signal Backups
GNU General Public License v3.0
212 stars 17 forks source link

HMAC verification failed #36

Open necrophcodr opened 3 years ago

necrophcodr commented 3 years ago

The latest version of signal-backup-decode doesn't appear to want to decrypt recent backups?

I've verified and re-created backups a couple of times now, and it always fails decrypting them again. However, noteworthy is that it isn't because the actual pass phrase is incorrect. I've tried with incorrect pass phrases, and it fails after a certain amount of frames, not after the first frame (which usually happens with incorrect pass phrases).

mutlusun commented 3 years ago

Hello @necrophcodr ,

Unfortunately I could not verify your issue. Do you have any debug output (--verbosity debug)? Which database version has your backup file?

Best

necrophcodr commented 3 years ago

I tried running it with the variable you requested as follows:

+ signal-backup-decode signal-2021-01-01-18-45-05.backup --password-file signal.backup.key.txt -o signal -f --verbosity debug
10:47:09 [INFO] Output path: signal               
10:47:09 [INFO] Input file: signal-2021-01-01-18-45-05.backup
10:47:09 [DEBUG] (1) signal_backup_decode::input: Frame type: Header Frame (salt: [3F, 11, 3D, D8, 06, 22, A6, AC, BE, 3B, E0, 3
8, 7D, 05, F4, 19, 9A, CB, C5, 39, 81, 8B, FE, D6, B1, 45, FB, C2, 25, 93, 73, A8] (length: 32), iv: [D5, 69, 92, 30, B2, EB, 61
, FF, 6F, 24, 3E, 52, 62, AB, 1A, 29] (length: 16))
10:47:09 [DEBUG] (2) signal_backup_decode::input: Read frame number 1 with length of 14 bytes
10:47:09 [ERROR] HMAC verification failed (their mac: [F0, E5, 55, 90, 1A, 47, AA, C2, FC, 01], our mac: [3B, 01, 52, 1D, 9C, 27
, 24, 09, 61, 14]).                                             

I'm not sure what database version it is. How would I figure this out?

mutlusun commented 3 years ago

I'm sorry, the database version is shown after the first frame is decrypted.

Does it always fail at the first frame? This could indicate that your password file is wrongly formatted. Only the first line is read of the password file.

What happens if you add --no-verify-mac?

Edit: If you want to, you can test my pull request: https://github.com/mutlusun/signal-backup-decode I have added a check for password length there.

necrophcodr commented 3 years ago

Tried with the parameter and

+ signal-backup-decode signal-2021-01-01-18-45-05.backup --password-file signal.backup.key.txt -o signal -f --verbosity debug --
no-verify-mac                                                   
13:41:14 [INFO] Output path: signal               
13:41:14 [INFO] Input file: signal-2021-01-01-18-45-05.backup
13:41:14 [DEBUG] (1) signal_backup_decode::input: Frame type: Header Frame (salt: [3F, 11, 3D, D8, 06, 22, A6, AC, BE, 3B, E0, 3
8, 7D, 05, F4, 19, 9A, CB, C5, 39, 81, 8B, FE, D6, B1, 45, FB, C2, 25, 93, 73, A8] (length: 32), iv: [D5, 69, 92, 30, B2, EB, 61
, FF, 6F, 24, 3E, 52, 62, AB, 1A, 29] (length: 16))
13:41:14 [DEBUG] (2) signal_backup_decode::input: Read frame number 1 with length of 14 bytes
13:41:14 [ERROR] HMAC verification failed (their mac: [F0, E5, 55, 90, 1A, 47, AA, C2, FC, 01], our mac: [84, 17, A5, EE, 6A, C2
, E3, 84, E7, 54]).                                             

I'll give the PR a try too.

necrophcodr commented 3 years ago

There's no difference with running it from your fork. Installed it using cargo install --path ., and after running it as above, the output was identical.

mutlusun commented 3 years ago

I'm sorry, I don't really know what's going on here. @pajowu do you have any idea?

necrophcodr commented 3 years ago

Don't forget the number one rule: the customer lies. I may be missing something somewhere or whatever that I just don't realize. I'm trying my best, but don't forget that I didn't write this, and have little to no knowledge about how it actually works, so if I'm doing something incorrectly, I probably wouldn't know.

necrophcodr commented 3 years ago

Also do note that I tried with an older password that no longer works, and it gave me the same output? The lengths are identical, but it appears that no matter what password I use, I get the same output.

necrophcodr commented 3 years ago

Turns out the key WAS incorrect. So I tried it with the correct key:

+ signal-backup-decode signal-2021-01-03-16-00-17.backup --password-file signal.backup.key.txt -o signal -f --verbosity debug --no-verify-mac                      
17:11:28 [INFO] Output path: signal                                                                                                                                
17:11:28 [INFO] Input file: signal-2021-01-03-16-00-17.backup                                                                                                      
17:11:28 [DEBUG] (1) signal_backup_decode::input: Frame type: Header Frame (salt: [EA, 5F, 12, F4, E3, 98, 35, 0B, 02, 7A, 67, 85, F4, 06, C3, A2, 67, DB, A1, AD, 
F6, C8, C3, 47, D2, 0A, 2B, 79, 54, 60, 20, 41] (length: 32), iv: [4E, 8E, DA, EE, 46, D5, A2, 8C, 69, EF, 01, 7F, E7, 5A, DF, 0C] (length: 16))                   
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 1 with length of 14 bytes                                                                      
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Version (85)                                                                                         
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 2 with length of 52 bytes                                                                      
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 3 with length of 814 bytes                                                                     
17:11:28 [INFO] Database Version: 85                                                                                                                               
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 4 with length of 1407 bytes                                                                    
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: CREATE TABLE sms (_id integer PRIMARY KEY, thread_id INTEGER, address TEXT, address_device_
id INTEGER DEFAULT 1, person INTEGER, date INTEGER, date_sent INTEGER, protocol INTEGER, read INTEGER DEFAULT 0, status INTEGER DEFAULT -1,type INTEGER, reply_path
_present INTEGER, delivery_receipt_count INTEGER DEFAULT 0,subject TEXT, body TEXT, mismatched_identities TEXT DEFAULT NULL, service_center TEXT, subscription_id I
NTEGER DEFAULT -1, expires_in INTEGER DEFAULT 0, expire_started INTEGER DEFAULT 0, notified DEFAULT 0, read_receipt_count INTEGER DEFAULT 0, unidentified INTEGER D
EFAULT 0, reactions BLOB DEFAULT NULL, reactions_unread INTEGER DEFAULT 0, reactions_last_seen INTEGER DEFAULT -1, date_server INTEGER DEFAULT -1, remote_deleted I
NTEGER DEFAULT 0, notified_timestamp INTEGER DEFAULT 0)                          
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 5 with length of 938 bytes                                                                     
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 6 with length of 704 bytes                                                                     
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 7 with length of 222 bytes                                                                     
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 8 with length of 101 bytes                                                                     
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 9 with length of 293 bytes                                                                     
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 10 with length of 426 bytes                                                                    
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 11 with length of 166 bytes                                                                    
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 12 with length of 147 bytes                                                                    
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 13 with length of 199 bytes                                                                    
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 14 with length of 176 bytes                                                                    
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: CREATE TABLE mms (_id INTEGER PRIMARY KEY, thread_id INTEGER, date INTEGER, date_received I
NTEGER, msg_box INTEGER, read INTEGER DEFAULT 0, m_id TEXT, sub TEXT, sub_cs INTEGER, body TEXT, part_count INTEGER, ct_t TEXT, ct_l TEXT, address TEXT, address_de
vice_id INTEGER, exp INTEGER, m_cls TEXT, m_type INTEGER, v INTEGER, m_size INTEGER, pri INTEGER, rr INTEGER, rpt_a INTEGER, resp_st INTEGER, st INTEGER, tr_id TEX
T, retr_st INTEGER, retr_txt TEXT, retr_txt_cs INTEGER, read_status INTEGER, ct_cls INTEGER, resp_txt TEXT, d_tm INTEGER, delivery_receipt_count INTEGER DEFAULT 0,
 mismatched_identities TEXT DEFAULT NULL, network_failures TEXT DEFAULT NULL,d_rpt INTEGER, subscription_id INTEGER DEFAULT -1, expires_in INTEGER DEFAULT 0, expir
e_started INTEGER DEFAULT 0, notified INTEGER DEFAULT 0, read_receipt_count INTEGER DEFAULT 0, quote_id INTEGER DEFAULT 0, quote_author TEXT, quote_body TEXT, quot
e_attachment INTEGER DEFAULT -1, quote_missing INTEGER DEFAULT 0, shared_contacts TEXT, unidentified INTEGER DEFAULT 0, previews TEXT, reveal_duration INTEGER DEFA
ULT 0, reactions BLOB DEFAULT NULL, reactions_unread INTEGER DEFAULT 0, reactions_last_seen INTEGER DEFAULT -1, date_server INTEGER DEFAULT -1, remote_deleted INTE
GER DEFAULT 0, quote_mentions BLOB DEFAULT NULL, mentions_self INTEGER DEFAULT 0, notified_timestamp INTEGER DEFAULT 0, viewed_receipt_count INTEGER DEFAULT 0)
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 15 with length of 450 bytes                                                                    
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: CREATE TABLE part (_id INTEGER PRIMARY KEY, mid INTEGER, seq INTEGER DEFAULT 0, ct TEXT, na
me TEXT, chset INTEGER, cd TEXT, fn TEXT, cid TEXT, cl TEXT, ctt_s INTEGER, ctt_t TEXT, encrypted INTEGER, pending_push INTEGER, _data TEXT, data_size INTEGER, fil
e_name TEXT, thumbnail TEXT, aspect_ratio REAL, unique_id INTEGER NOT NULL, digest BLOB, fast_preflight_id TEXT, voice_note INTEGER DEFAULT 0, data_random BLOB, th
umbnail_random BLOB, quote INTEGER DEFAULT 0, width INTEGER DEFAULT 0, height INTEGER DEFAULT 0, caption TEXT DEFAULT NULL, sticker_pack_id TEXT DEFAULT NULL, stic
ker_pack_key DEFAULT NULL, sticker_id INTEGER DEFAULT -1, data_hash TEXT DEFAULT NULL, blur_hash TEXT DEFAULT NULL, transform_properties TEXT DEFAULT NULL, transfe
r_file TEXT DEFAULT NULL, display_order INTEGER DEFAULT 0, upload_timestamp DEFAULT 0, cdn_number INTEGER DEFAULT 0, borderless INTEGER DEFAULT 0, sticker_emoji TE
XT DEFAULT NULL)                        
...
17:11:28 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement                                                                                            
17:11:28 [DEBUG] (2) signal_backup_decode::input: Read frame number 138 with length of 292 bytes                                                                   
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO sms VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)         
17:11:28 [ERROR] HMAC verification failed (their mac: [A5, FF, 33, 63, 6F, 6F, 37, A3, 37, 7F], our mac: [69, 95, BD, 11, 47, 92, A2, F2, 1B, 30]).                
hrehfeld commented 2 years ago

Freshly built from git.

$ signal-backup-decode -V
signal-backup-decode 0.2.3

I'm running into something similar, where over 9k frames get decoded before I run into HMAC verification:

signal-backup-decode signal-2022-02-11-10-52-14.backup -p'<key>' -f                  
13:05:56 [INFO] Output path: signal-2022-02-11-10-52-14
13:05:56 [INFO] Input file: signal-2022-02-11-10-52-14.backup
13:05:56 [INFO] Database Version: 129
             Bytes read: [00:00:09] [#################################>----------------] 4.00GB/6.03GB
Read vs. written frames: [00:00:09] [##################################################]  9408/9408 
13:06:06 [ERROR] HMAC verification failed (their mac: [00, 00, 00, 00, 00, 00, 00, 00, 00, 00], our mac: [95, EB, F9, EC, FA, 7F, A7, 36, F8, D3]).

with debug:

13:08:42 [INFO] Output path: signal-2022-02-11-10-52-14
13:08:42 [INFO] Input file: signal-2022-02-11-10-52-14.backup
13:08:42 [DEBUG] (1) signal_backup_decode::input: Frame type: Header Frame (salt: [54, BA, 63, 74, B0, F7, 6E, F0, 07, E8, BD, 61, BE, 17, 86, B6, 62, 90, E6, DA, AE, 93, E9, D4, 2A, 03, 83, 72, 94, 59, E7, D0] (length: 32), iv: [C3, FF, 1B, 97, 0B, F2, D4, 7A, 9D, DF, 20, A7, 26, 99, CF, 56] (length: 16))
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 1 with length of 15 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Version (129)
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 2 with length of 52 bytes
13:08:42 [INFO] Database Version: 129
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 3 with length of 967 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 4 with length of 101 bytes
13:08:42 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: CREATE TABLE part (_id INTEGER PRIMARY KEY, mid INTEGER, seq INTEGER DEFAULT 0, ct TEXT, name TEXT, chset INTEGER, cd TEXT, fn TEXT, cid TEXT, cl TEXT, ctt_s INTEGER, ctt_t TEXT, encrypted INTEGER, pending_push INTEGER, _data TEXT, data_size INTEGER, file_name TEXT, thumbnail TEXT, aspect_ratio REAL, unique_id INTEGER NOT NULL, digest BLOB, fast_preflight_id TEXT, voice_note INTEGER DEFAULT 0, data_random BLOB, thumbnail_random BLOB, quote INTEGER DEFAULT 0, width INTEGER DEFAULT 0, height INTEGER DEFAULT 0, caption TEXT DEFAULT NULL, sticker_pack_id TEXT DEFAULT NULL, sticker_pack_key DEFAULT NULL, sticker_id INTEGER DEFAULT -1, data_hash TEXT DEFAULT NULL, blur_hash TEXT DEFAULT NULL, transform_properties TEXT DEFAULT NULL, transfer_file TEXT DEFAULT NULL, display_order INTEGER DEFAULT 0, upload_timestamp DEFAULT 0, cdn_number INTEGER DEFAULT 0, borderless INTEGER DEFAULT 0, sticker_emoji TEXT DEFAULT NULL, video_gif INTEGER DEFAULT 0)
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 5 with length of 293 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 6 with length of 461 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 7 with length of 166 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 8 with length of 147 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 9 with length of 199 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 10 with length of 450 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 11 with length of 112 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 12 with length of 112 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 13 with length of 58 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 14 with length of 68 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: CREATE TABLE drafts (_id INTEGER PRIMARY KEY, thread_id INTEGER, type TEXT, value TEXT)
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 15 with length of 79 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: CREATE TABLE push (_id INTEGER PRIMARY KEY, type INTEGER, source TEXT, device_id INTEGER, body TEXT, content TEXT, timestamp INTEGER, server_timestamp INTEGER DEFAULT 0, server_guid TEXT DEFAULT NULL, source_uuid TEXT DEFAULT NULL, server_delivered_timestamp INTEGER DEFAULT 0)
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 16 with length of 67 bytes
13:08:42 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:08:42 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: CREATE TABLE groups (_id INTEGER PRIMARY KEY, group_id TEXT, title TEXT, members TEXT, avatar BLOB, avatar_id INTEGER, avatar_key BLOB, avatar_content_type TEXT, avatar_relay TEXT, timestamp INTEGER, active INTEGER DEFAULT 1, avatar_digest BLOB, mms INTEGER DEFAULT 0, recipient_id INTEGER DEFAULT 0, master_key, revision, decrypted_group, expected_v2_id TEXT DEFAULT NULL, former_v1_members TEXT DEFAULT NULL, distribution_id TEXT DEFAULT NULL)
13:08:42 [DEBUG] (2) signal_backup_decode::input: Read frame number 17 with length of 69 bytes

[.....................]

13:05:33 [DEBUG] (2) signal_backup_decode::input: Read frame number 9401 with length of 756 bytes
13:05:33 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:05:33 [DEBUG] (2) signal_backup_decode::input: Read frame number 9402 with length of 26 bytes
13:05:33 [DEBUG] (2) signal_backup_decode::input: Frame type: Attachment (size: 61294)
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [DEBUG] (2) signal_backup_decode::input: Read frame number 9403 with length of 756 bytes
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:05:33 [DEBUG] (2) signal_backup_decode::input: Read frame number 9404 with length of 26 bytes
13:05:33 [DEBUG] (2) signal_backup_decode::input: Frame type: Attachment (size: 141372)
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [DEBUG] (2) signal_backup_decode::input: Read frame number 9405 with length of 756 bytes
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:05:33 [DEBUG] (2) signal_backup_decode::input: Read frame number 9406 with length of 26 bytes
13:05:33 [DEBUG] (2) signal_backup_decode::input: Frame type: Attachment (size: 166304)
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [DEBUG] (2) signal_backup_decode::input: Read frame number 9407 with length of 776 bytes
13:05:33 [DEBUG] (2) signal_backup_decode::input: Frame type: Statement
13:05:33 [DEBUG] (2) signal_backup_decode::input: Read frame number 9408 with length of 26 bytes
13:05:33 [DEBUG] (2) signal_backup_decode::input: Frame type: Attachment (size: 440988)
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [DEBUG] (3) signal_backup_decode::output_raw: Write statement: INSERT INTO part VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
13:05:33 [ERROR] HMAC verification failed (their mac: [00, 00, 00, 00, 00, 00, 00, 00, 00, 00], our mac: [95, EB, F9, EC, FA, 7F, A7, 36, F8, D3]).

Their mac is 0 though -- is this the same issue or should I open a new one?

This also happens with --no-verify-mac

mutlusun commented 2 years ago

Thanks for your report. It would be cool to add a flag to recover from such errors (having only (at least) one bad frame). However, I have probably too less time to implement this at the moment.

Regarding your current problem: A MAC with 0 seems strange to me. Maybe the backup is corrupt? Does this error also appear when creating a new backup and decoding this one?

If you are depending on this backup and the files in it you can try the --no-verify-mac. At least, the decoding process should work if the length of the frames are still correct. Please report back, if there is also an error with this flag.

hrehfeld commented 2 years ago

(I was already trying

This also happens with --no-verify-mac

and error still happened)

Backup was freshly written, but I will try another one

hrehfeld commented 2 years ago

Meh, my error was NOT related to signal-backup-decode.

I saved signal backups to the sd-card, which was formatted with exfat, which cut off the file at 4gb (but for some reason filesize after copying was still 6gb, I don't know)

necrophcodr commented 2 years ago

Meh, my error was NOT related to signal-backup-decode.

I saved signal backups to the sd-card, which was formatted with exfat, which cut off the file at 4gb (but for some reason filesize after copying was still 6gb, I don't know)

That's odd. exFAT supports files larger than 4GB just fine.

mutlusun commented 2 years ago

Either way, the printed error should be another one with --no-verify-mac. It seems, it is still trying to verify the MAC even told not to do so ...

othmanelhoufi commented 1 year ago

Same issue.

14:50:04 [INFO] Output path: signal-2021-05-11-20-19-32
14:50:04 [INFO] Input file: Desktop/signal-2021-05-11-20-19-32.backup
14:50:04 [DEBUG] (1) signal_backup_decode::input: Frame type: Header Frame (salt: [55, AA, 0F, CD, 2A, BD, 38, E9, B0, 91, 68, E0, D6, 2F, 67, 6A, DB, B4, 21, 6F, 0A, 69, 18, 30, 7D, F9, A6, 13, 2B, 9A, 16, DD] (length: 32), iv: [9E, 40, 3C, 83, 3C, 0E, 44, 58, A3, B2, EE, 53, 52, 1A, BF, 78] (length: 16))
14:50:04 [DEBUG] (2) signal_backup_decode::input: Read frame number 1 with length of 14 bytes
14:50:04 [ERROR] HMAC verification failed (their mac: [D1, B0, BF, C6, B6, 75, 13, 53, 94, 78], our mac: [3F, FF, 81, F2, 84, 7B, CC, B2, 96, 48]).