errbufferoverfl / usb-canary

A Linux or OSX tool that uses psutil to monitor devices while your computer is locked. In the case it detects someone plugging in or unplugging devices it can be configured to send you an SMS or alert you via Slack or Pushover.
GNU General Public License v3.0
575 stars 66 forks source link

check_state will not catch changes that don't change the total number of mounted file systems #18

Open jaseg opened 7 years ago

jaseg commented 7 years ago

canary.operating_system.helpers.check_state will fail to catch any change in mounted file systems that does not change the total number of mounted file systems (as seen by psutil).

Expected Behavior

Consider a laptop with usb-canary running during screen lock, and the screen being locked while a usb disk containing a single ntfs partition is attached and that partition is mounted. Automount is enabled.

Now consider an attacker unplugs the ntfs usb disk and plugs in another ntfs-formatted, single-partition usb-disk. This other disk is auto-mounted. Note that this is a common scenario when a device has limited USB ports available.

usb-canary should immediately raise hell.

Current Behavior

usb-canary will not notice anything happened provided the change happened quick enough between two checks (likely).

Possible Solution

Properly compare states. Compare more than just device name, mountpoint, filesystem type and options. At least also monitor:

Steps to Reproduce (for bugs)

(no poc provided)

Context

usb-canary at least on first glance looks like a security tool. Thus it should be secure.

Your Environment

This is independent of operating system.

errbufferoverfl commented 7 years ago

Hi @jaseg,

Thanks for submitting an issue, this has been put into the roadmap. Again thanks for taking the time to contribute to USB Canary.

errbufferoverfl commented 6 years ago

Began looking into this issue late last year, I believe I have a working improved solution, however along with changes to this I am making a number of other changes which may see the major increased.