element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Enchanted Objects
  • Challenges & Projects
  • Design Challenges
  • Enchanted Objects
  • More
  • Cancel
Enchanted Objects
Blog Enchanted Objects Design Challenge - Locking the doors
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Workshopshed
  • Date Created: 22 Jun 2015 8:09 AM Date Created
  • Views 1059 views
  • Likes 4 likes
  • Comments 1 comment
  • enchanted_cottage
  • security
  • enchanted_objects
  • arduino_yun
Related
Recommended

Enchanted Objects Design Challenge - Locking the doors

Workshopshed
Workshopshed
22 Jun 2015

Following lots of rude interruptions from the Wolf, Hans decided the Arduino Yún's security needed beefing up. After a bit of reading Hans realised that this could be a 16 week design challenge in it's own right.

 

Hans' plan of action for the lock down was as follows:

 

  • Users and passwords
  • Handle brute force attacks
  • Remove unused functions
  • Apply principle of least privilege

 

Passwords

Hans had already changed the default root password to something unique but realised if he was sending out lots of IOT devices it would make sense to have a mechanism where you could provide everyone of them with a unique default password. This could be printed on a label on the bottom of the device so if it was reset to defaults it would take this rather than something that people could google for.

 

It's possible to check the user accounts by looking at the passwords file.

 

cat /etc/passwd

 

Installed by default on the Yún are the following:

root:x:0:0:root:/root:/bin/ash
daemon:*:1:1:daemon:/var:/bin/false
ftp:*:55:55:ftp:/home/ftp:/bin/false
network:*:101:101:network:/var:/bin/false
nobody:*:65534:65534:nobody:/var:/bin/false

 

Given that there's no FTP then the FTP user is a candidate for removal, although it would make sense to check that is not used for the WebUI.

 

We can disable the accounts using

 

passwd -l username

Brute Force

The Enchanted Cottage has some protection against brute force attacks in that the Linino portion and hence the Wifi is turned off for most the the time hence there is no way to connect. However in the computer world the few seconds that the system is up and connected should sufficient for a break to be attempted.

 

The two areas that could be vulnerable to this are the Web Admin UI provided by Arduino and the SSH port. It might be possible to turn these off. Given that these are used to fix or configure the device that's maybe not a good idea.  It's also possible to configure SSH to use certificates rather than password for login. To do this on the finished product we'd need to have some way of getting the keys back and forth.

 

This can be setup by following the instructions for setting up Drop Bear SSH for Public/Private Key authentication

image

The best method for handling brute force attacks is to use a intruder detection system such as Fail2Ban which uses the inbuilt firewall IPTables to lockout IPaddress that have strange activity patterns. The only dependency for Fail2Ban appears to be Python so for the cottage this seems like a good solution. The module is not yet available as a downloadable OPKG package but it can be installed manually. Fail2ban install on GNU Linux

 

The daemon file need tweeking to run on this platform, one from RedHat was used as a basis.

https://github.com/Workshopshed/EnchantedObjects/blob/master/Code/Scripts/fail2ban-initd

 

and this was tested with

/etc/init.d/fail2ban start

 

and

/etc/init.d/fail2ban stop

 

Removing features

Whilst Hans was researching security he had a visit from the Woodcutter who wanted to see how the build was coming on. Whilst they were wandering around admiring the structure the Woodcutter tripped on a stump and reached out and grabbed the nearest thing to him, a hanging basket of flowers. The chain supporting the basket broken and the basket and Woodcutter went crashing to the ground. The Woodcutter picked himself up and brushed off the soil and flowers. He looked at the basket on the floor and said "a chain is only as strong as it's weakest link". He picked up the basket, passed it to Hans and wandered off into the forest.

 

Hans realised that there were features on the Yún that were not being used. These could be removed to stop them being the weakest link.

 

Looking at the list of installed packages there seems to be some candidates for removal.

 

  • avahi - A Zero Configuration network tool.
  • cpu-mcu-bridge - The bridge, this is already swapped out so is not used.
  • spacebrew - A friendly wrapper for APIs
  • temboo - A friendly wrapper for APIs

 

Hans also wondered about avrdude, the tool for putting new sketches onto the AtMega. But removing that would stop the end user applying patches over the Wifi.

 

opkg remove temboo
opkg remove spacebrew
opkg remove cpu-mcu-bridge

 

Removing avahi raised a warning that it was used by depended on by other package so it was not removed at this time.

 

The other key feature to review is the Rest API, the uhttp webserver publishes data on the Arduino pins and can control the ATMega via a correctly constructed URL.

e.g.

http://<Arduino_Yún_Address>/arduino/mode/13/output

 

We can disable the Arduino specific end points by editing the /etc/httpd.conf file to comment out lines by putting an # in front of them.

 

#A:/arduino:/cgi-bin/luci/arduino%s
 #A:/data:/cgi-bin/luci/data%s
 #A:/mailbox:/cgi-bin/luci/mailbox%s

 

Principles of least privilege

This security concept is basically don't give more permissions that is needed to do the task required. Then if anything goes wrong or there's a security loophole then a hacker is less likely to be able to escalate their privileges further.

 

Again, swapping out the bridge code with the reduced functionality of the python script means that the ATMega has access to less of the Linino side. However, python is running as root, which is a bit much given that it only needs to read a configuration file and get a file off the network to process and send via serial the ATMega.

 

There are tools to help lock down these permissions such as SELinux but it would appear that these would need the Kernel patching which unfortunately means I don't have time to implement this process.

 

Next: Enchanted Objects Design Challenge - Tools

 

References

SSH Tutorial for Linux - Support Documentation

MQTT Security Fundamentals - Securing MQTT Systems

The 10 challenges of securing IoT communications  |  Atmel | Bits & Pieces

Arduino.cc List of Yún packages

https://github.com/arduino/YunBridge/blob/master/bridge/bridge.py

Welcome to pySerial’s documentation — pySerial 2.7 documentation

20 Linux Server Hardening Security Tips

operating systems - Hardening Linux Server - Information Security Stack Exchange

Using REST with Arduino Yun | Open Electronics

Web Server Configuration (uHTTPd)

What is the principle of least privilege?

Minimize Privileges

SELinux The_security_context_of_a_process

  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 10 years ago +1
    Nice methodical approach to security. Mark
Parents
  • mcb1
    mcb1 over 10 years ago

    Nice methodical approach to security.

     

    Mark

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • mcb1
    mcb1 over 10 years ago

    Nice methodical approach to security.

     

    Mark

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube