Testing Linux skills

Michael Halcrow mike at halcrow.us
Wed Jan 18 20:24:59 MST 2006


On Wed, Jan 18, 2006 at 07:59:52PM -0700, Bryan Sant wrote:
> On 1/18/06, Michael Halcrow <mike at halcrow.us> wrote:
> > Heh. Here, I've got something to throw in root's crontab:
> >
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > #include <fcntl.h>
> > #include <unistd.h>
> > #include <stdlib.h>
> > #include <time.h>
> > #include <stdio.h>
> >
> > int main()
> > {
> >         int fd;
> >         unsigned long offset;
> >         char buf;
> >
> >         srand(time(NULL));
> >         offset = rand() % 2000000;
> >         buf = offset % 255;
> >         fd = open("/proc/kcore", O_WRONLY); /* You need SE Linux ;-) */
> >         if (fd == -1) {
> >                 printf("Run me as root\n");
> >                 return 1;
> >         }
> >         lseek(fd, offset, SEEK_SET);
> >         write(fd, &buf, 1);
> >         close(fd);
> >         return 0;
> > }
> 
> Or for the lazy:
> while true; do
> cat /dev/random > /proc/kcore
> done

The trick is to not make the computer crash *too* quickly or *too*
predictably. Little things need to happen. Like, process names and
attributes need to get tweeked just a tad here and there. Inodes need
to be occasionally linked to random parts of memory. DMA transfers
need to jump a few bytes off from where they should be reading.

BTW, this won't work w/ more recent kernels.

;-)

Mike
.___________________________________________________________________.
                         Michael A. Halcrow                          
       Security Software Engineer, IBM Linux Technology Center       
GnuPG Fingerprint: 419C 5B1E 948A FA73 A54C  20F5 DB40 8531 6DCA 8769

Every rule has an exception, except the rule of exceptions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
Url : http://plug.org/pipermail/plug/attachments/20060118/6a20667a/attachment.bin 


More information about the PLUG mailing list