Skip to contentSkip to conversation

Disturbing news..

DISCUSSION Jesse Pollard 3 participants 3 messages Mar 28, 2001 – Mar 29, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 11 lines · Jesse Pollard
Quoted 6 lines
Quoted 2 lines

Any idea?

Sure - very simple. If the execute bit is set on a file, don't allow ANY write to the file. This does modify the permission bits slightly but I don't think it is an unreasonable thing to have.

Quoted 5 lines

And how exactly does this help?

fchmod (fd, 0666);
fwrite (fd, ...);
fchmod (fd, 0777);

By itself it doesn't - but if you also don't have user/group/world rw and don't own the file, you can't do anything to it.

It's only there to reduce accidents. If you want to go full out, remove the symbols from the file.

Now, if ELF were to be modified, I'd just add a segment checksum for each segment, then put the checksum in the ELF header as well as in the/a segment header just to make things harder. At exec time a checksum verify could (expensive) be done on each segment. A reduced level could be done only on the data segment or text segment. This would at least force the virus to completly read the file to regenerate the checksum.

That change would even allow for signature checks of the checksum if the signature was stored somewhere else (system binaries/setuid binaries...). But only in a high risk environment. This could even be used for a scanner to detect ANY change to binaries (and fast too - signature check of checksums wouldn't require reading the entire file).

In any case, the problem is limited to one user, even if nothing is done.

-------------------------------------------------------------------------
Jesse I Pollard, II
Email: [email protected]

Any opinions expressed are solely my own.

#1 lore raw
Quoted 6 lines · Jesse Pollard

Now, if ELF were to be modified, I'd just add a segment checksum for each segment, then put the checksum in the ELF header as well as in the/a segment header just to make things harder. At exec time a checksum verify could (expensive) be done on each segment. A reduced level could be done only on the data segment or text segment. This would at least force the virus to completly read the file to regenerate the checksum.

Checksums don't help that much - virus writers would treat it as "part of the set of alterations that need to be made" and then the checksum becomes zero protection.

Your system binaries are safe from the virus (from my understanding of the poor writeup) if you are sensible about your system - ie, don't run stuff as the root user, don't login as root, ensure that your binaries are owned by root etc.

If users have their own binaries, then they should take adequate care over them (find ~ -type f -perm +111 | xargs chmod a-w) to ensure that they are not writable (this applies to your argument as well).

Once you're in this situation:

1. Users can't write to their executables without first chmod'ing them. (won't take long for a virus writer to get the idea that they should chmod +w them first).

2. If a user binary becomes infected, only people able to run that binary also become infected. Certainly root should under no circumstances run any program which a user has compiled - the user may have some nice code in there which creates another root user in /etc/passwd with no password entry.

3. Since you're only running system programs as root (and by that I mean stuff for administration, not stuff like mail clients, news readers etc), your system binaries should not become infected.

Therefore, if you follow good easy system administration techniques, then you end up minimising the risk of getting:

1. viruses
2. trojans
3. malicious users

cracking your system. If you don't follow these techniques, then you're asking for lots of trouble, and no amount of checksumming/signing/etc will ever save you.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

#2 lore raw
In reply to Jesse Pollard
Quoted 2 lines · Jesse Pollard

By itself it doesn't - but if you also don't have user/group/world rw and don't own the file, you can't do anything to it.

This is all completely useless. Why not remove world rw permissions in the first place. If the admin isn't even able to write a cron job that does this, all help is lost.

Quoted 2 lines

It's only there to reduce accidents. If you want to go full out, remove the symbols from the file.

Just as useless.

Quoted 6 lines

Now, if ELF were to be modified, I'd just add a segment checksum for each segment, then put the checksum in the ELF header as well as in the/a segment header just to make things harder. At exec time a checksum verify could (expensive) be done on each segment. A reduced level could be done only on the data segment or text segment. This would at least force the virus to completly read the file to regenerate the checksum.

So? The virus will just redo the checksum. Sooner or later their will be a routine to do this in libbfd and this all reduces to a single additional line of code.

Quoted 5 lines

That change would even allow for signature checks of the checksum if the signature was stored somewhere else (system binaries/setuid binaries...). But only in a high risk environment. This could even be used for a scanner to detect ANY change to binaries (and fast too - signature check of checksums wouldn't require reading the entire file).

One sane way to do this is to store the sig on a ro medium and make the kernel check the sig of every binary before it is run.

HOWEVER, this means no compilers will work, and you have to delete all script languages like perl or python (or make all of them check the signature).

Useless again, IMO.

Quoted 1 line

In any case, the problem is limited to one user, even if nothing is done.

Your best bet is to educate your users.

Walter