I'm a part of a small team of undergraduate developers taking a course on developing Arduino and Raspberry Pi applications with a focus on the Internet of Things. Our current task is to imagine, design, and implement some useful system with the following requirements:

  1. We must make use of a Raspberry Pi
  2. We must use some external sensor or actuator in tandem with the Raspberry Pi
  3. We must implement a web system supporting the physical device in some way

We've decided to make use of a magnetic valve to prevent unauthorized users from accessing a liquid. Use cases could include safely storing hazardous or poisonous liquids, preventing the theft of valuable liquids, or preventing minors from accessing alcohol.

To be more specific, we have connected our Raspberry Pi to the magnetic valve and to a number pad. When you enter a certain PIN, the valve opens temporarily to allow the flow of liquid and then closes after a fixed amount of time. This setup is considered one device.

We've developed a web system that allows a user with one of these devices to register an account with us. They are required to have a key located on the device to register an account. Once their account with us has been made, they can register additional devices if they have them. The user establishes a PIN for each registered device through the web system. They can use the web system to change their password for their web account, change PINs for any of their devices, and view reported logs of every time their device was successfully accessed.

Once a user has one of these devices and has registered online and established a PIN, their device is ready to dispense their liquid. The valve is attached to a very hardy container that locks into the mechanism, preventing an unauthorized user from simply removing the container of liquid from the device. Assume that the physical security of the valve itself, the container, and the locking mechanism are ensured for the purposes of this academic scenario.

When a user wants to access their securely stored liquid, they enter the associated PIN into a number pad attached to the Raspberry Pi. Their PIN is hashed and sent over the Internet to our server for comparison with the hashed PIN stored in our database. If the PIN is correct, the server returns to the device with a success signal. When the device receives a success signal the valve is opened for a fixed amount of time, set so that a certain volume of liquid will be dispensed before the valve closes once again. The server takes note of when the successful request occurred for logging purposes.

My problem is that the valve is opened and closed with two simple functions located on the Raspberry Pi itself. The application we've developed for controlling the device waits until it receives the success signal before opening and closing the valve, but I don't know how to stop a malicious user from writing their own application and making use of these two functions to open and close the valve.

The Raspberry Pi has both a video port and USB ports on the side. A malicious user that happens to be alone with the device could bring their own monitor and keyboard and hook up to the Raspberry Pi and run an application that could call the same functions that open and close the valve. How can I prevent this from happening?

Do I need the Pi to be secured physically so that the user can reach the number pad, but not the Pi itself? Is there a way to be to block the available ports from being used? Any suggestions as to how to handle this situation would be greatly appreciated. Security is not the main focus of this assignment, but I'd like to do the very best that I can.

  • I'm sure it wouldn't be difficult to disable the video outputs. USB ports can be managed with a tool such as USBGuard. But what about the SD card? Someone could remove it and modify the logic from a different computer. – multithr3at3d Dec 8 '18 at 21:21

Depending on your threat model you could add enclosures, alarms, CCTV, access controls to the room, a security guard etc... but without knowing what you want to do it is hard to say where to stop.

I would certainly consider securing the Pi itself - a locked metal container, securely fixed to the wall/device will make any attack harder/noisier/more obvious. Adding an alarm will also improve this.

If you can find an enclosure which incorporates a secure keypad (ie one that is hard to break and is tamper evident) that will help you prevent an attack.

Sealing ports can help, but if an attacker gets into the enclosure, they could access the traces on the PCB so while it has some deterrent value, I wouldn't recommend it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.