for the programmer:
for the malware analyst/user
#! perl -T
# -T: enable taint tracking
use warnings; use strict;
$ENV{PATH} = '/usr/bin:/bin';
print "Enter name: ";
my $name = readline(STDIN);
my $dir = $name . "-dir";
system("mkdir $dir");
#! perl -T
# -T: enable taint tracking
use warnings; use strict;
$ENV{PATH} = '/usr/bin:/bin';
print "Enter name: ";
my $name = readline(STDIN);
# keep $name only if its all alphanumeric
# this marks $name as untainted
($name) = $name =~ /^([a-zA-Z0-9]+)$/;
my $dir = $name . "-dir";
system("mkdir $name");
mark contents of file as tainted, then ID how used
figure out where network packet data goes
can ‘tag’ each byte of input differently
whole-system probably too high overhead to do in realtime
add %r9, (%r8): memory-taint-table[register-values[R8]] |= register-taint-table[R9]
xor %eax, %eax: special case: remove taint from %eaxkeycode = GetFromKeyboard();
switch (keycode) {
case KEYCODE_A: return 'a';
case KEYCODE_B: return 'b';
...
}
if a malware author wanted to defeat this taint checking, what ideas seem promising for confusing the analysis?
x = y to switch (x) { case 1: y = 1; break; case 2: ...}x = y to x = z + y; x = x - z;