3 ms·
I've seen scripts (self-extracting archives for Linux, for example) that checksum themselves either by some trickery, or just ignoring the first line after the
by bombcar 3y ago
I've seen scripts (self-extracting archives for Linux, for example) that checksum themselves either by some trickery, or just ignoring the first line after the shebang (which itself is the computed checksum of the rest of the file).
- Scaevolus 3y agoIncorporating an MD5 quine into a shellscript would be funny.
- seeknotfind 3y agoAnd a sha256 quine would be terrifying. :)
- cassianoleal 3y agoThat can be useful against download corruption but wouldn't do much against an actual attack (in this case, the attacker can just update the checksum).
- kazinator 3y agoThe problem is, the wrong party is doing the check (from a security point of view, not integrity). When we download a script from a remote domain we don't trust, we have to validate its checksum against the known one; we can't leave that to the script, which we don't trust.
- kevincox 3y ago99% of the time you are downloading from a domain that you do trust. This check is to detect corruption, not malice. But yes, if you were downloading from an untrusted mirror you would want to check the signature or trusted hash before running the script at all.
- joshspankit 3y agoIn this case we’re specifically talking about the possibility of a truncated script from a trusted source