Skip to content
File upload Advisory Advanced CVE-2017-2850

Foscam IP Video Camera CGIProxy.fcgi Change Username pureftpd.passwd Injection Vulnerability

The camera's username-change command writes the new username into the FTP password database without validating its characters. An authenticated administrator could inject extra characters into that file and thereby bypass the FTP server's chroot restriction.

Claudio Bozzato Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable injection vulnerability exists in the web management interface used by the Foscam C1 Indoor HD Camera running application firmware 2.52.2.37. A specially crafted HTTP request can allow for a user to inject arbitrary characters in the pureftpd.passwd file during a username change, which in turn allows…

Claudio Bozzato, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The new username is concatenated into the pureftpd.passwd line with snprintf without any validation or escaping of special characters.

Impact

An authenticated administrator could inject arbitrary characters into the FTP password database, which in turn allows bypassing chroot restrictions in the FTP server.

What the attacker needed

Administrator (privilege 2) account; network access to the camera's web interface

How it was found

  1. Send an HTTP request to the camera's CGIProxy.fcgi service invoking the changeUserName command with the usrName, newUsrName, usr and callbackJson parameters.
  2. Authenticate as a user with administrator privilege (privilege 2).
  3. The service extracts the parameters and calls changeAccountUsername.
  4. The function reads the whole pureftpd.passwd file and locates the line for the old username.
  5. It rebuilds the line with the unvalidated new username and runs pure-pw mkdb to apply the change.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

The camera keeps a list of FTP users in a text file, one line per user. When an administrator renames a user, the camera pastes the new name straight into that file without checking it. By putting special characters in the name, an attacker can add extra fields to the line, which the FTP server then trusts, letting them escape the folder they are normally locked into.

What is File upload?

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

More by Claudio Bozzato

View all

185 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.