
An authentication bypass was recently discovered (https://www.webarxsecurity.com/vulnerability-infinitewp-client-wp-time-capsule/) on WP Time Capsule < 1.21.16. This PoC proves how the issue works and how it can be exploited.
WP Time Capsule < 1.21.16에서 인증 우회(Authentication Bypass) 취약점이 최근 발견되었습니다 (https://www.webarxsecurity.com/vulnerability-infinitewp-client-wp-time-capsule/). 이 PoC는 해당 문제가 어떻게 동작하며 어떻게 악용될 수 있는지를 증명합니다.
이 PoC는 두 가지 옵션을 제공합니다:
poc.py http://127.0.0.1/
poc.py http://127.0.0.1 shell
wptc-cron-functions.php 내부에 있으며 Wptc_Init 생성자에 의해 호출되는 decode_server_request_wptc() 함수는 본문(body)으로 전송된 요청을 디코딩할 때 어떠한 권한 검사도 수행하지 않습니다:
if( !empty($HTTP_RAW_POST_DATA_LOCAL)
&& strpos($HTTP_RAW_POST_DATA_LOCAL, 'IWP_JSON_PREFIX') !== false ){
wptc_log('', "--------IWP_JSON_PREFIX--coming------");
wp_cookie_constants();
wptc_login_as_admin();
}
단순히 모든 POST 요청의 본문에 IWP_JSON_PREFIX 문자열이 포함되어 있는지만 확인하며, 포함되어 있으면 다음 메서드를 호출합니다:
wp_cookie_constants();
wptc_login_as_admin();
wptc_login_as_admin()은 모든 관리자 사용자를 가져와 첫 번째 사용자를 추출한 후 해당 사용자 이름에 대한 쿠키를 반환합니다.
function wptc_login_as_admin(){
wptc_log(func_get_args(), "--------" . __FUNCTION__ . "--------");
wptc_define_admin_constants();
if( !function_exists('is_user_logged_in') ){
include_once( ABSPATH . 'wp-includes/pluggable.php' );
}
if(is_user_logged_in()){
return ;
}
$admins = get_users(array('role' => 'administrator'));
foreach ($admins as $admin) {
$user = $admin;
break;
}
if (isset($user) && isset($user->ID)) {
wp_set_current_user($user->ID);
// Compatibility with All In One Security
update_user_meta($user->ID, 'last_login_time', current_time('mysql'));
}
if(!defined('SECURE_AUTH_COOKIE')){
return;
}
$isHTTPS = (bool)is_ssl();
if($isHTTPS){
wp_set_auth_cookie($user->ID);
} else{
wp_set_auth_cookie($user->ID, false, false);
wp_set_auth_cookie($user->ID, false, true);
}
}
이 테스트를 위해 다음을 사용했습니다:
수행 단계:
