1

CVE-2023-42793 JetBrains TeamCity 权限绕过

 9 months ago
source link: https://y4er.com/posts/cve-2023-42793-jetbrains-teamcity-auth-bypass-rce/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

CVE-2023-42793 JetBrains TeamCity 权限绕过

 2023-09-26  2023-12-08  约 710 字  预计阅读 2 分钟 

https://www.jetbrains.com/zh-cn/teamcity/download/other.html

https://download.jetbrains.com.cn/teamcity/plugins/internal/CVE-2023-42793-fix-recent-versions.zip

补丁下下来发现这是个插件,其中只有一个类 org.jetbrains.teamcity.FixRPC2Requests

image.png

唯一作用就是从RequestInterceptors对象中拿到myPreHandlingDisabled字段值,然后移除掉/**/RPC2

在RequestInterceptors类中

image.png
public static String getPathSuffix() {
    return "/RPC2";
}

也就是说默认myPreHandlingDisabled添加了/app/agents/**/**/RPC2/

在这个RequestInterceptors拦截器中的preHandle函数中

image.png



image.png



image.png

match函数中用ant风格匹配uri

image.png

所以我们找路由可以构成/**/RPC2的利用点即可

在rest-api插件中jetbrains.buildServer.server.rest.request.UserRequest#createToken(java.lang.String, java.lang.String, java.lang.String)

image.png

满足/RPC2的条件,可以给任意用户创建一个name为RPC2的token,然后用token调用即可绕过鉴权。

image.png

然后有这个token,你可以直接添加一个用户

image.png

或者直接加header头,访问/admin/admin.html也行。

随便改改补丁插件包,后台传插件rce

image.png

加内存马什么的,随便写。

文笔垃圾,措辞轻浮,内容浅显,操作生疏。不足之处欢迎大师傅们指点和纠正,感激不尽。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK