Skip to content

Local extra field data for timestamps occasionally re-written incorrectly #510

Description

@pianistrevor

What happened?

I've been using ipatool for awhile now, alongside iTunes. I've been comparing the timestamps of extracted files (particularly Apple's code signature) and it appears that some apps have timestamps with extra data that is not preserved by ipatool.

For reference, here are four archives I've compared today:

  • Kroger SVEI 888026966, from iTunes 12.6.5
  • Kroger SVEI 888026966, from ipatool
  • United Airlines SVEI 888081233, from iTunes 12.6.5
  • United Airlines SVEI 888081233, from ipatool

With Kroger, when I view both archives using zipinfo -v, or unzip -l, I see the timestamp for the CodeResources file as 2026-07-09 00:27:50, which is adjusted to my timezone of UTC -7:00. WinRAR shows 2026-07-09 07:27:50, which is likely the UTC timestamp. Extracting via unzip preserves this timestamp correctly, so my local timestamp shows what the zipinfo shows.

With United, things get funky. Viewing both archives using zipinfo -v and unzip -l shows the timestamp for the CodeResources file as 2026-07-10 16:58:26, which happens to be in the future from when I'm writing this. WinRAR shows this as well. I assume this is not actually correct for my local time, as adjusted to UTC -7 it would be 2026-07-10 09:58:26. When I extract with unzip, however, the iTunes archive actually does extract correctly - and the resulting file shows 9:58 AM as I'd expect. With the ipatool archive, the extraction does not convert this and shows 4:58 PM.

I wrote a small python script to peer into the local file header and extra data associated with each of these four archives. Here is what I found:

--- krogerItunes.ipa ---
File: Payload/kroger.app/_CodeSignature/CodeResources
  Raw Local Time/Date Hex: 793b e95c
  Local Extra Field Length: 16 bytes
--- krogerTool.ipa ---
File: Payload/kroger.app/_CodeSignature/CodeResources
  Raw Local Time/Date Hex: 793b e95c
  Local Extra Field Length: 12 bytes
--- unitedItunes.ipa ---
File: Payload/UnitedCustomerFacingIPhone.app/_CodeSignature/CodeResources
  Raw Local Time/Date Hex: 4d87 ea5c
  Local Extra Field Length: 16 bytes
--- unitedTool.ipa ---
File: Payload/UnitedCustomerFacingIPhone.app/_CodeSignature/CodeResources
  Raw Local Time/Date Hex: 4d87 ea5c
  Local Extra Field Length: 0 bytes

Source archives seem to have the NTFS timestamp, which makes sense as it is downloaded from the Windows iTunes client. But, it seems that in one case, the local extra field length is converted by Go correctly to a 12-byte sequence (likely extended timestamp block with the epoch), while in the other case, it's being dropped entirely.

Version

2.3.1

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions