bucanero / apollo-ps3

Apollo Save Tool (PS3)
http://www.bucanero.com.ar/
GNU General Public License v3.0
357 stars 23 forks source link

Final Fantasy XIII-2 Asia version cannot decrypt properly #109

Closed eric14142004 closed 1 year ago

eric14142004 commented 1 year ago

I am trying to decrypt, apply cheats and resign the Final Fantasy XIII-2 Asia version [BCAS20224], but it ends up corrupting the save file. It seems like the APP.DAT is not decrypted properly and failed the checksum. Tested in both ver 1.7.4 and 1.8

Here is the log: [2023-03-12 09:56:27] Loaded 1187 codes [2023-03-12 09:56:38] Applying SFO patches '/dev_hdd0/home/00000001/savedata/BCAS20224-00/PARAM.SFO'... [2023-03-12 09:56:38] PARAM.SFO was patched successfully [2023-03-12 09:56:38] Applying cheats to 'FINAL FANTASY XIII-2'... [2023-03-12 09:56:38] Active code: [Read Encryption KEY.DAT (Required)] [2023-03-12 09:56:38] Decrypting 'KEY.DAT'... [2023-03-12 09:56:38] (KEY.DAT) fsize = 16 / aligned fs = 16 [2023-03-12 09:56:38] Bruteforce Save Data Code [2023-03-12 09:56:38] Applying [Read Encryption KEY.DAT (Required)] to '/dev_hdd0/home/00000001/savedata/BCAS20224-00/KEY.DAT'... [2023-03-12 09:56:38] Var name = key [2023-03-12 09:56:38] [key]:read(0x0 , 0x10) = B997E833 [2023-03-12 09:56:38] Active code: [Decrypt APP.DAT (Required)] [2023-03-12 09:56:38] Decrypting 'APP.DAT'... [2023-03-12 09:56:38] Error: can't find 'APP.DAT' in PARAM.PFD [2023-03-12 09:56:38] Error getting AES keys [2023-03-12 09:56:38] Bruteforce Save Data Code [2023-03-12 09:56:38] Applying [Decrypt APP.DAT (Required)] to '/dev_hdd0/home/00000001/savedata/BCAS20224-00/APP.DAT'... [2023-03-12 09:56:38] RANGE = 0 (0x0) - 560736 (0x88E60) [2023-03-12 09:56:38] FFXIII Type=2 Encryption Key= [key] [2023-03-12 09:56:38] [*] Total Decrypted Size Is 0x88E60 (560736 bytes) [2023-03-12 09:56:38] [!] Decrypted data did not pass file integrity check. (Expected: 2B502E38 Got: 5D13FF00) [2023-03-12 09:56:38] Encrypting 'KEY.DAT'... [2023-03-12 09:56:38] Check (KEY.DAT) fsize = 16 / PFD fsize = 16 [2023-03-12 09:56:38] (KEY.DAT) fsize = 16 / aligned fs = 16 [2023-03-12 09:56:38] Encrypting 'APP.DAT'... [2023-03-12 09:56:38] Error: can't find 'APP.DAT' in PARAM.PFD [2023-03-12 09:56:38] Error updating PARAM.PFD details [2023-03-12 09:56:38] Resigning save 'FINAL FANTASY XIII-2'...

bucanero commented 1 year ago

As mentioned in #108 , a bug was recently added to the FFXIII encryption on the ps3.

If you want, I suggest to try older versions. For example the first version with FFXIII decryption support to compare: https://github.com/bucanero/apollo-ps3/releases/tag/v1.5.5

But in any case, to properly test and fix this for the next version, I'll need the original XIII-2 save that you are using, before applying any changes or hacks. (I need the original working save) Use Apollo to export the original non-modified save to ZIP and attach the exported zip to this issue so I can review it properly.

eric14142004 commented 1 year ago

Tested again with v1.5.5, see the same error message in log, and save file corrupted.

Here is the original save file: BCAS20224

eric14142004 commented 1 year ago

I have tested again in v1.5.5 with another region of FFXIII-2 [BLUS30776], and the decryption seems to work fine. Maybe the issue only occurs in [BCAS20224]?

Here is the original save file I tested: BLUS30776

bucanero commented 1 year ago

thanks for sharing the zips for the saves.

Interesting, so the XIII-2 decryption works fine on BLUS, but fails on BCAS. 🤔 Maybe there's something different between regions, like encryption keys depending on region?

Btw, if you want to do further testing, you could try using PC tools to decrypt the BCAS data. My suggestion would be using "Bruteforce Save data" tool, and then the original FFXIII decrypt tool by Jappi88.

The PC decryptor tool can be downloaded here: https://github.com/bucanero/ps3-save-decrypters/raw/master/ff13-decrypter/samples/ffx13-encryptor.rar

I can't remember right now, but I think that Jappi88 decryptor actually handles the PS3 encryption too, so you might not need Bruteforce Savedata, unless you want to apply cheats. But to test the decryption, you can check that PC tool.

When I take a look I'll also share my findings.

eric14142004 commented 1 year ago

Thanks for sharing Jappi88's encryptor! However, it seems like this tool does not support BCAS20224:

2023-03-12 142723

I saw someone reported to Jappi88 for the same issue around 9 years ago, not sure if there's an updated version of this tool or not 🤣

I also tested another tool you made from https://github.com/bucanero/ps3-save-decrypters, also getting the same "integrity check" error message:

2023-03-12 142517

Look forward for you finds! Big thanks!

bucanero commented 1 year ago

Thanks for sharing Jappi88's encryptor! However, it seems like this tool does not support BCAS20224:

I saw someone reported to Jappi88 for the same issue around 9 years ago, not sure if there's an updated version of this tool or not 🤣

oh if Jappi's decrypt tool also fails then I'm not sure there's an easy fix around, since his tool was meant to be "universal" and it could even decode Xbox360 saves too. But clearly, BCAS20224 saves are using something different, either a key or seed is different from the regular XIII-2 saves.

I also tested another tool you made from https://github.com/bucanero/ps3-save-decrypters, also getting the same "integrity check" error message:

Look forward for you finds! Big thanks!

My tool and the code in Apollo are based on Jappi88's tool, so I'm inheriting any error or limitation from the original tool. (As noted on your screenshots, both tools are reporting the "data did not pass integrity check" 😓 )

eric14142004 commented 1 year ago

That make sense then!

Any good suggestions about how to find the correct key or seed of BCAS20224 saves?

gfhhhg commented 1 year ago

This tool can https://www.360haven.com/forums/downloads.php?do=file&id=773

bucanero commented 1 year ago

This tool can https://www.360haven.com/forums/downloads.php?do=file&id=773

I don't own BCAS20224 so I can't say, but I'm not sure if that tool by Jappi88 will work with this issue. The "FF13-2 save editor" was released on 2012, and the "Multi-FF13-encryptor" by Jappi88 was released on 2013.

maybe @eric14142004 can test out this save editor and confirm if it was able to edit the save and the game loaded it properly or not.

eric14142004 commented 1 year ago

@gfhhhg @bucanero Just tested with my BCAS20224 save, and unfortunately, that tool does not work.

bucanero commented 1 year ago

@gfhhhg @bucanero Just tested with my BCAS20224 save, and unfortunately, that tool does not work.

Thanks for testing. I assumed that this wouldn't work. (the "save editor" by Jappi was older than the multi-decrypter by the same Jappi88). I'll leave this ticket open for reference, but unless the EBOOT.BIN from BCAS20224 is reversed and decompiled, I guess this Asia region save will remain encrypted.

gfhhhg commented 1 year ago

@gfhhhg @bucanero Just tested with my BCAS20224 save, and unfortunately, that tool does not work.

I also have the game BCAS20224, which I successfully modified many years ago using this tool. Today, I tested it again and still successfully modified it. Did you make any mistakes in the operation there ff132 132

eric14142004 commented 1 year ago

Well, this is interesting, because I was able to modify my save with this tool, but I cannot read the save file when I upload it back to my PS3. Could you please try if you can?

gfhhhg commented 1 year ago

Well, this is interesting, because I was able to modify my save with this tool, but I cannot read the save file when I upload it back to my PS3. Could you please try if you can?

I don't have any issues here. Has your game updated to 1.06? If not, please update to 1.06 before saving and trying to modify it

eric14142004 commented 1 year ago

I think this is the resolution! My save data was before v1.06, I have tested again after creating a new save file in v1.06 and it's working now! Thank you so much for sharing!

bucanero commented 1 year ago

I think this is the resolution! My save data was before v1.06, I have tested again after creating a new save file in v1.06 and it's working now!

Thank you so much for sharing!

As a final test, could you check if the 1.06 save can be also decrypted with the other decrypt tool by Jappi or my tools? it also gives errors?

gfhhhg commented 1 year ago

I think this is the resolution! My save data was before v1.06, I have tested again after creating a new save file in v1.06 and it's working now! Thank you so much for sharing!

As a final test, could you check if the 1.06 save can be also decrypted with the other decrypt tool by Jappi or my tools? it also gives errors?

FF13 encryption and apollo-ps3 are both invalid for BCAS20224 and can damage the archive. I have tested both and only Final Fantasy XIII-2: Save editor can be used

bucanero commented 1 year ago

FF13 encryption and apollo-ps3 are both invalid for BCAS20224 and can damage the archive. I have tested both and only Final Fantasy XIII-2: Save editor can be used

Thanks for testing. So, a quick summary:

BCAS20224 save, v1.06

could you upload a working sample v1.06 save-game? at least to test on my side and check what could the editor be doing with the save. All the other editions work fine, so I still wonder if it's just a different key.

gfhhhg commented 1 year ago

FF13 encryption and apollo-ps3 are both invalid for BCAS20224 and can damage the archive. I have tested both and only Final Fantasy XIII-2: Save editor can be used

Thanks for testing. So, a quick summary:

BCAS20224 save, v1.06

  • Final Fantasy XIII-2 Editor by Jappi88 = OK ✅
  • Final Fantasy XIII Encryptor by Jappi88 = Error 🛑
  • Apollo = Error 🛑

could you upload a working sample v1.06 save-game? at least to test on my side and check what could the editor be doing with the save. All the other editions work fine, so I still wonder if it's just a different key.

FF13 encryption and apollo-ps3 are both invalid for BCAS20224 and can damage the archive. I have tested both and only Final Fantasy XIII-2: Save editor can be used

Thanks for testing. So, a quick summary:

BCAS20224 save, v1.06

  • Final Fantasy XIII-2 Editor by Jappi88 = OK ✅
  • Final Fantasy XIII Encryptor by Jappi88 = Error 🛑
  • Apollo = Error 🛑

could you upload a working sample v1.06 save-game? at least to test on my side and check what could the editor be doing with the save. All the other editions work fine, so I still wonder if it's just a different key.

The reason was found that the original Secure File ID was incorrect. This is the correct Secure File ID: 070BB2ADBCA037B32AD3BF41C90644BB. Replacing the incorrect Secure File ID in games.conf can solve the problem

bucanero commented 1 year ago

The reason was found that the original Secure File ID was incorrect. This is the correct Secure File ID: 070BB2ADBCA037B32AD3BF41C90644BB. Replacing the incorrect Secure File ID in games.conf can solve the problem

Oh, that explains the problem! thanks for sharing the info and the correct secure file-id. 👍 I'll be running a final test and update the files to fix this issue.

bucanero commented 1 year ago

Fixed in https://github.com/bucanero/apollo-patches/commit/423b9d9e5e7bdb830378df87f5a351fc27c49e45

Tested with the correct secure file-id provided by @gfhhhg , and the decrypter works ok 👍

./ff13-ps3save-decrypter -d -2 APP.DAT

ff13-ps3save-decrypter 0.1.0 - (c) 2021 by Bucanero

[*] Total Decrypted Size Is 0x88E60 (560736 bytes)
[*] Decrypted File Successfully!

Users need to update the games.conf file to solve this issue: