News for hackers. Stuff that matters.

Ask HN: I downloaded a malicious dmg file but did not open it. Am I infected?

I was setting up a new MacBook and searched for iterm2 on Google. I hadn't installed an adblocker yet and I clicked on the sponsored link (screenshot: https://imgur.com/a/vlyh5re) which had the address `https://www.iterm-2.com` on the ad but it took me to `https://iterm2.mom/`. I only noticed the URL right after clicking download. I deleted the file without opening it. Can I still be infected? Should I erase the disk and install the OS again?

I reported the ad but it is still available when I search for iterm2 (might help if you report it too).

( 8 comments | 8 points | on HN )
Re:Ask HN: I downloaded a malicious dmg file but did not ope... by TZubiri on Saturday May 18, 2024 @05:54PM (#40402437)
If you just downloaded it but didn't open the file, you are not infected.
Re:Ask HN: I downloaded a malicious dmg file but did not ope... by viraptor on Saturday May 18, 2024 @05:59PM (#40402474)
Most likely that's correct. Unless there exists some MacOS issue where just loading the thumbnail or metadata from that file would lead to exploit. It's extremely unlikely that's the case of a 0-click unpatched exploit on a random public file, but just wanted to note this for completeness - if you're paranoid about this case for some reason, it's possible in theory.
Re:Ask HN: I downloaded a malicious dmg file but did not ope... by krackers on Saturday May 18, 2024 @06:28PM (#40402617)
macOS does have quicklook generators, and the system seems very eager to register things with launchServices even before the app has been opened once. Perhaps this has been tightened on recent macOS versions, but otherwise it seems theoretically possible to get code running in a "0-click" fashion, simply by mounting a DMG which contains an app with a qlgenerator and another file with matching file type.
Re:Ask HN: I downloaded a malicious dmg file but did not ope... by dinkblam on Saturday May 18, 2024 @05:55PM (#40402444)
Even if you mount the DMG, there is no infection. You'd need to launch the malicious app.

Edit: its not an app but a command-line binary with ad-hoc signature.

Re:Ask HN: I downloaded a malicious dmg file but did not ope... by mindcrash on Saturday May 18, 2024 @05:57PM (#40402460)
Unless it was user-disabled Gatekeeper (https://support.apple.com/guide/security/gatekeeper-and-runt...) is running on your system to prevent malware infection when you have accidentally opened a malicious app, so you should be fine either way.
Re:Ask HN: I downloaded a malicious dmg file but did not ope... by arghtw on Saturday May 18, 2024 @07:25PM (#40402920)
Use homebrew next time :)
[dead]
Re:Ask HN: I downloaded a malicious dmg file but did not ope... by neglesaks on Saturday May 18, 2024 @06:40PM (#40402693)
ChatGPT is a terrible source of info of security related topics.
Re:Ask HN: I downloaded a malicious dmg file but did not ope... by JoeyBananas on Saturday May 18, 2024 @09:57PM (#40403564)
protip, install software using a package manager from a reputable package repository