PHP session.save_path open_basedir Bypass Vulnerability

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1052977 漏洞类型
发布时间 2007-04-01 更新时间 2007-04-01
漏洞平台 N/A CVSS评分 N/A
When an empty session save path is supplied the files session storage modules falls back to the path specified by the TMPDIR environment variable. Unfortunately this magic fallback happens after the open_basedir check and can therefore be used to bypass it.

Detailed information

The summary and the POC say it all.
Proof of concept, exploit or instructions to reproduce

To check this problem try the following code, when open_basedir is set.

  ini_set("session.save_path", "/sessions/user2/");
  ini_set("session.save_path", "");

The first ini_set() will error out, because the path is in violation with the open_basedir. The second ini_set() will succeed and the session file will be created in the path specified by TMPDIR.

We recommend to never ever rely on open_basedir. We consider the open_basedir restrictions just a nice way to decrease the impact of include vulnerabilities.

The MOPB should have made clear by now, that the moment an attacker is able to run PHP code, PHP has more than enough flaws for him to bypass all restrictions enforced by the PHP interpreter.