Wrestling Control of my Webcam
Tags: security, iot, hacking
Published: 2018-11-11 11:27:22

---
title: Wrestling Control of my Webcam
published: true
tags: security,iot,hacking
canonical_url: https://neil.bar/wrestling-control-of-my-webcam-78070a1a9d30?source=your_stories_page---------------------------&gi=6cf8471591c4
cover_image: https://cdn-images-1.medium.com/max/1024/1*HI21nYu022Fis-0PqseBbA.jpeg
---

This post originally appeared (ages ago) on [my personal blog](https://neil.bar). These devices are certainly still kicking around so the information is still relevant.

A few months [now years] ago I ordered a generic IP webcam from Amazon. A [COOLEAD L610WS](http://www.coolead.net/product/product-72-698.html) arrived the next day. The reason behind this purchase was to act as a baby monitor for our new daughter.

![](https://cdn-images-1.medium.com/max/1024/1*kkWeGulyDlzNHJCbsQKQfQ.png)

### Paranoid much?

There has been much discussion about the security of [IoT](https://en.wikipedia.org/wiki/Internet_of_Things) devices such as this webcam. This even broke out of the confines of geek sites and into the [mainstream press](https://www.theguardian.com/technology/2016/jan/25/search-engine-lets-users-find-live-video-of-sleeping-babies).

I knew that this device would be insecure when I purchased it. My view was that securing it was just a matter of changing the default passwords and updating the configuration — as I would do on any device I purchased.

This was not the case and the more I dug, the more fail I found.

#### Danger!

![](https://cdn-images-1.medium.com/max/480/1*U6BEvCPVOOKe45kIhu5N0Q.jpeg)<figcaption>“I also use telnetd”</figcaption>

- This webcam is massively insecure if you just plug it in and use.
- Even if you spend some time updating passwords and configuration, it is not much better.
- The firmware and set-up do not look to have seen any form of quality control.
- By default this webcam is immediately accessible from the internet and due to some bad code, can’t be disabled.

#### External Access

In an attempt to make it easy for people to view the webcam from outside the confines of their home network, a number of options are typically offered by these sorts of device:

- The webcam will use a p2p system and open up ports on your router via [UPnP](https://en.wikipedia.org/wiki/Universal_Plug_and_Play).
- You can upload images to an FTP site.
- You can send images via email.
- The documentation will suggest opening up ports on your router to allow access.
- A dynamic domain name service (DDNS) will ensure you can always connect, even if your router changes IP.
- An even scarier alternative is that the webcam will upload images/footages to the **manufacturer’s servers** for you to view from their website.

My webcam offers a p2p system, a dynamic name service, FTP upload and email.

### Software

#### Browser

Plugging in the webcam and browsing to the IP address serves me a standard HTTP authentication screen.

![](https://cdn-images-1.medium.com/max/784/1*icp_rxzEAYSzVJD58HzpOA.png)

Note ‘Your connection to this site is not private’. This means that your user name and password are sent over the network (or internet) in cleartext and can be trivially intercepted.

After authentication, you are presented with a number of options to view your camera based on your OS/browser (IE, not IE, mobile).

![](https://cdn-images-1.medium.com/max/1024/1*RMR-TgQid090L7-rzwZ33A.png)

The IE option offers the download of some software via a link which helpfully includes your username and password. I’d go **nowhere** near any software bundled with this webcam — I don’t need it and would not trust it anyway.

So far, nothing I have seen is instilling any confidence in the software. Let’s inspect the page which displays the video/image from the webcam:

![](https://cdn-images-1.medium.com/max/1024/1*NP6tY5PwGsaPUhEc23mS2A.png)

That looks like commented out development code. It also betrays the default admin user and password (_admin,_ with no password).

#### Configuration

I tried locking down the DDNS configuration on this device but I can’t. The option is there, but my choice is not actioned or even saved after clicking either of the mislabelled buttons.

![](https://cdn-images-1.medium.com/max/1024/1*2GRnHZ4XY7SRehf5VcfhAg.png)

A look at the source shows more commented out code, this time its JS.

![](https://cdn-images-1.medium.com/max/1024/1*B9hXqy19cf-kcPqRMlX8qw.png)

Thanks to that code snippet, the following request _would_ disable DDNS. I don’t trust this device though.

{% gist https://gist.github.com/neilbartley/f6ed8184cf37660ce6f770ce47d0374b %}

There is **no** option in the admin section to turn off the p2p option. I’d guess it probably would not have worked anyway!

The _script_ declarations at the top of the index file reference a couple of cgi files. These are used to set variables for **every** configuration option for each page. Let’s take a look at them.

#### get\_status.cgi

{% gist https://gist.github.com/neilbartley/d23d9da01cdc7cbd35ff68ebb91d4411 %}

#### get\_params.cgi

Highlights:

- Username and passwords for all other users.
- Network configuration, including the SSID and WiFi password.

_(I’ve stripped out some consecutive variables to save some lines)._

{% gist https://gist.github.com/neilbartley/3ed4d4b86d67679ff549e040f6de1f52 %}

#### set\_alias.cgi

![](https://cdn-images-1.medium.com/max/874/1*qvr6RdW0yP_Tfn0IXeOSMg.png)

This script is used to set the alias of the device — to give it a friendly name. I decided to pick on this particular [cgi](https://en.wikipedia.org/wiki/Common_Gateway_Interface) as it is simple (one value) and is displayed on most (if not all) pages outside of the admin area.

What I was looking for was a [cross site scripting (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) vector.

_Credit to_ [_Lud_](http://www.drolez.com/) _for beating me to it _[_here_](http://www.drolez.com/blog/?category=Hardware&post=jw0004-webcam)_._

![](https://cdn-images-1.medium.com/max/1024/1*WsEIT9JvTgs1_GE9hXPrZw.png)

Now look what happens when I log in:

![](https://cdn-images-1.medium.com/max/1024/1*axcmjuVqqk0mniqvELqZhw.png)

I expect the other forms which take text input are equally as susceptible, but are likely limited to the admin pages.

The XSS injected here is a harmless popup but it is not inconceivable that something much more malicious could be cooked up. As [Lud](http://www.drolez.com/) points out, the lack of [cross site request forgery (CSRF)](https://en.wikipedia.org/wiki/Cross-site_request_forgery) protection could allow the users browser to be taken over.

### Device

#### Firewall Logs

{% gist https://gist.github.com/neilbartley/e949a0c99e468aaba2369eb487965a51 %}

I'm going to guess the latter three servers are something to do with the p2p functionality of this webcam. _I’ll maybe investigate these further with_ [_Wireshark_](https://www.wireshark.org/) _at some point._

#### 54.247.103.91

This looks to be a box hosted with AWS (in Ireland).

![](https://cdn-images-1.medium.com/max/646/1*QqbqezCJJ7YgiuwXcsizRg.png)

Hitting this on port 80 returns the following from a very online Apache 2.2.22 instance.

#### 54.217.201.148

This looks to be an Ubuntu box, also hosted with AWS (in Ireland).

![](https://cdn-images-1.medium.com/max/970/1*d65HhWTWuTgF3J2HXr5SGg.png)

Port 80 gives up a default configured Apache 2.2.22 instance.

#### Others

- 128.138.141.172 — This is an NTP server at the University of Colorado.
- 54.245.98.57 — Another AWS box located in the US.
- 123.56.159.92 — This is a box located in Hangzhou, Zhejiang, China and is hosted by Aliyun Computing Co.

### Services

Let’s see what services are running on the device. We’ll use the stalwart of network scanners, [nmap](https://nmap.org/).

The options used are;

- -sS — Scan TCP ports (SYN)
- -sU — Scan UDP ports
- -sV — Try and figure out what version of the service is running

{% gist https://gist.github.com/neilbartley/0a6fd3e6de114f35a20a16e91e5c9502 %}

#### Telnet

Telnet has no place on this device. It certainly shouldn't be enabled by default and I wonder why it is. Its worth noting that the username and password which is set for the web interface does not work here.

Let’s point [Metasploit](https://www.metasploit.com/) at this and see if we can get a login.

[Metasploit](https://www.metasploit.com/) is a framework for developing and executing exploit code against a remote target machine. It comes bundled with a bunch of scanners. We’ll make use of _auxiliary/scanner/telnet/telnet\_login_.

I've presumed that the _root_ account is going to be accessible (and not locked down by disabling its access). This presumption is based on what I have seen so far.

It took [less than 3 minutes](https://asciinema.org/a/5voi0pypq2b8kxx6ysa7o7nqk) to find that ‘123456’ was the root password.

### Lots of people have beat me to this!

- PenTestPartners — Hacking the IP Camera: [part 1](https://www.pentestpartners.com/blog/hacking-the-ip-camera-part-1/) | [part 2](https://www.pentestpartners.com/blog/hacking-the-aldi-ip-cctv-camera-part-2/)
- Krebs on Security — [This is Why People Fear the ‘Internet of Things’](http://krebsonsecurity.com/2016/02/this-is-why-people-fear-the-internet-of-things/)
- Lud’s open source corner — [Wanscam JW0004 IP Webcam hacking](http://www.drolez.com/blog/?category=Hardware&post=jw0004-webcam)

### Conclusion

![](https://cdn-images-1.medium.com/max/850/1*Gqb46Q9cRX3ECVt0g-qJSA.png)

The IoT is great — you can pick up a wireless infra-red webcam for under £30. However, you get what you pay for.

- The firmware makes use of insecure technologies (telnet, FTP, no SSL on web, SMTP) which allow for data to be easily intercepted.
- The software seems to have been clobbered together without any thought for best practices, security, review or testing.
- The infrastructure the device talks to doesn't give me any confidence — a service which displays a default (Apache) page has not been configured correctly. I’d not fancy trusting it with my personal information.

It seems that these devices, which look to be essentially the same but made by different companies, all use a similar software base. This is then tweaked occasionally at the whim of the given manufacturer.

These devices are not aimed at tech-savvy individuals and most people won’t know how easily these can be exploited by inquisitive or malicious parties.

> The only way I can see to safely use this webcam is to prevent the device from accessing the internet at all.

> At this point my ‘Internet of Things’ device is more accurately an ‘of Things’ device.

### Ghosts?

This is a question which I’d not considered when making my choice.

![](https://cdn-images-1.medium.com/max/1024/1*NcGjQkZM-RILny5QcyipDA.png)

* * *