oss-sec mailing list archives

Re: openssh on linux rce in sftp-only mode


From: Jann Horn <jann () thejh net>
Date: Wed, 8 Oct 2014 11:23:05 +0200

On Wed, Oct 08, 2014 at 11:07:59AM +0200, Hanno Böck wrote:
This seems CVE-worthy:
http://seclists.org/fulldisclosure/2014/Oct/35

Quote:
"OpenSSH lets you grant SFTP access to users without allowing full
command execution using "ForceCommand internal-sftp". However, if you
misconfigure the server and don't use ChrootDirectory, the user will be
able to access all parts of the filesystem that he has access to -
including procfs. On modern Linux kernels (>=2.6.39, I
think), /proc/self/maps reveals the memory layout and /proc/self/mem
lets you write to arbitrary memory positions. Combine those and you get
easy RCE."

It involves a number of issues coming together, however in the end it
is an RCE with a legit configuration.

I reported this to the OpenSSH developers, and although they included my
patch as a mitigation, they did not treat it as a vuln in OpenSSH.

I believe that treating this as a hardening patch makes sense. The SFTP
server behaves exactly as documented, it allows access to the whole
filesystem. And on Linux, that happens to equal write access to the
process RAM, so you should never give that access to someone who
shouldn't be able to run arbitrary code.

Attachment: signature.asc
Description: Digital signature


Current thread: