For sake of example, let's say you were given an MP3 file, and you downloaded and played it? Could you get a virus from this?
I'm also interested in other types of files such as
.iso, etc. (
.exe files excluded)
Information Security Stack Exchange is a question and answer site for information security professionals. It only takes a minute to sign up.Sign up to join this community
It's possible to get infected with malware that sits in mp3s, jpgs, avis etc, but unlikely.
In order to get infected, the malicious code must be executed. So the audio, image or video player (specifically, the decompressor function which decompresses the data or the code which takes the decompressed data and plays/displays it) must be tricked into executing the data instead. This can happen, for example if the code reserves a fixed amount of space for the data which, if well-formed, will never take up more space. But if it does, maybe because a bad person made sure it would, it can overwrite part of the memory that follows the memory reserved for the data, and sometimes that memory contains an instruction on where to find the next instructions to run after the ones currently being carried out. If the attacker can adjust this "return address" to point into his own malicious code, he wins.
If you're interested in the technical details, google "buffer overflows" and "stack smashing".
So... it's not the audio/video file itself that's dangerous. It's the combination of the file and a specific audio/video player.If you don't watch the infected file with the target player, nothing will happen.