We are doing an project for a school competition in which we need to use a Raspberry Pi to make an IOT prototype. We received SD cards from the professor, and because we lost ours we asked another group to give us a copy of their card, I know it’s been modified because the original hash doesn’t match. Could you please investigate and tell me if everything is ok? Here is some parts of the file system:
By reading the description we know the attacker added some kind of backdoor our first intuition was to check the crontab files:
1 2
$ ls var/spool/cron/crontabs/ b4ckd00r_us3r pi
By checking the b4ckd00r_us3r we found out the backdoor is running in this cron task:
1 2 3 4 5 6
cat var/spool/cron/crontabs/b4ckd00r_us3r # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.80NKS4/crontab installed on Wed Oct 4 19:28:12 2017) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) # m h dom mon dow command @reboot python /bin/back
# uncompyle6 version 2.12.0 # Python bytecode 2.7 (62211) # [GCC 6.3.0 20170118] # Embedded file name: back.py # Compiled at: 2017-10-05 09:09:10 import sys import os import time from flask import Flask from flask import request from flask import abort import hashlib
defcheck_creds(user, pincode): if len(pincode) <= 8and pincode.isdigit(): val = '{}:{}'.format(user, pincode) key = hashlib.sha256(val).hexdigest() if key == '34c05015de48ef10309963543b4a347b5d3d20bbe2ed462cf226b1cc8fff222e': return'Congr4ts, you found the b@ckd00r. The fl4g is simply : {}:{}'.format(user, pincode) return abort(404)
The user is b4ckd00r_us3r we just need to bruteforce the pincode by looking at the code we know the pincode must be between 1 and 8 numbers using hashcat to crack the hash:
- Device #2: autotuned kernel-accel to 160 - Device #2: autotuned kernel-loops to 204 - Device #1: autotuned kernel-accel to 22 - Device #1: autotuned kernel-loops to 23 [s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => The wordlist or mask that you are using is too small. This means that hashcat cannot use the full parallel power of your device(s). Unless you supply more work, your cracking speed will drop. For tips on supplying more work, see: https://hashcat.net/faq/morework