Live data from Hacker News

Hackers use ZIP file concatenation to evade detection

bleepingcomputer.com

81–90 of 111 posts

Re: Hackers use ZIP file concatenation to evade detection

#81
post #39

Earlier quoted context omitted.

That seems counter to GP's suggestion of doing compression at a separate layer

Not really. There's no "dar compression" format. It calls different compression tools just like tar.

You could say the same about ZIP (it uses deflate by default but optionally supports things like zstd)

Re: Hackers use ZIP file concatenation to evade detection

#82
post #66
post #48

Earlier quoted context omitted.

I meant that they should be separate tools that can be piped together. For example: you have 1 directory of many files (1Gb in total) `zip out.zip dir/` This results in a single out.zip file that is, let's say 500Mb (1:2 compression) If you want to shard it, you have a separate tool, let's call it `shard` that works on any type of byte streams: `shard -I out.zip -O out_shards/ --shard_size 100Mb` This results in `out…

The key thing that you get by integrating the two tools is the ability to more easily extract a single file from a multipart archive— Instead of having to reconstruct the entire file, you can look in the part/diskette with the index to find out which other part/diskette you need to use to get at the file you want.

Don't forget that with this two-step method, you also require enough diskspace to hold the entire ZIP archive before it's sharded.

AFAIK you can create a ZIP archive saved to floppy disks even if your source hard disk has low/almost no free space.

Phil Katz (creator of the ZIP file format) had a different set of design constraints.

Re: Hackers use ZIP file concatenation to evade detection

#83

Remember, secure encryption, good compression, and truely random data are indistinguishable. It's best to paste that encrypted payload into a JPG with some bullshit magic headers and upload that to a trusted Exfil pivot instead. Or, to get SuperMarioKart.rom to work with your chromeApp-XEMU emulator to play during down-time at work, just rename it to SMB.png, and email it you yourself.

Good compression should still be cryptographically distinguishable from true randomness right?

Sure the various measures of entropy should be high, but I always just assumed that compression wouldn't pass almost any cryptographic randomness test.

Re: Hackers use ZIP file concatenation to evade detection

#84

Why do scanners need to look inside compressed archives at all? If the malicious file is extracted, it can be detected then. If it’s not extracted and instead used directly from the archive, then the offending code that executes malicious payloads from inside archives should be detectable? Is that the role of AutoIt in this scenario?

Because they want to check on the wire, before it hits an endpoint.

Common situation is detecting malware sent through a phishing mail. You want to intercept those before a user can unpack the file.

Re: Hackers use ZIP file concatenation to evade detection

#85
post #77

Earlier quoted context omitted.

I don't think you understand the reason for the ZIP archive file design. Back in the late 1980s, backup media for consumers was limited to mostly floppy disks, some users had tape/another hard disk. Say you had a variable number of files to compress and write out to a ZIP archive. IF you write out the central directory first, followed by all the individually possibly compressed and/or encrypted files, you'd have to c…

> coders discovered that scanning the ZIP local entries to be a faster way to build up the ZIP archive entries, otherwise you're forced to seek all the way to the end of a ZIP archive and work backwards to locate the central directory Would this have worked? Reserve a few bytes at the beginning of the archive at a fixed location offset from the start, and say "this is where we will write the offset to where the centr…

You forgot about the streaming case. ZIP creators can stream the archive out and never seek back earlier in the stream (send the data to another tool or a write-only medium).

The central directory at the end of the archive fits that constraint. Any design where a placeholder needs to be updated later won't.

Re: Hackers use ZIP file concatenation to evade detection

#87
post #84

Why do scanners need to look inside compressed archives at all? If the malicious file is extracted, it can be detected then. If it’s not extracted and instead used directly from the archive, then the offending code that executes malicious payloads from inside archives should be detectable? Is that the role of AutoIt in this scenario?

Because they want to check on the wire, before it hits an endpoint. Common situation is detecting malware sent through a phishing mail. You want to intercept those before a user can unpack the file.

And "Defense In Depth" - the more layers that bad actors have to avoid/circumvent reduces the chance of their success.

see https://www.fortinet.com/resources/cyberglossary/defense-in-...

Re: Hackers use ZIP file concatenation to evade detection

#88
post #42
post #40

Earlier quoted context omitted.

That's a very bad way of solving that issue. If transmission is a problem, either use a proper retry-friendly protocol (such as bittorrent) or split the file. Using hacks on the data format just leads to additional pain

couldn't agree more! We need to separate and design modules as unitary as possible: - zip should ARCHIVE/COMPRESS, i.e. reduce the file size and create a single file from the file system point of view. The complexity should go in the compression algorithm. - Sharding/sending multiple coherent pieces of the same file (zip or not) is a different module and should be handled by specialized and agnostic protocols that do…

I agree!

Also, I enjoyed your Freudian slip:

single respectability tools

->

single responsibility tools

Re: Hackers use ZIP file concatenation to evade detection

#90

Last I checked virustotal doesn't test nested archives for viruses even though it's an issue old as modern computing

VirusTotal just passes on the file to the actual virus scanners (a for-loop with an api as a front-end) - it's up to each individual virus scanner to scan as they see fit (including scanning any unreferenced holes and compressed zip entries in a zip archive).

I have no idea why those virus scanners don't check nested archives. Maybe time/cpu constraints?

Post reply on HN