Yahoo Bug Bounty Part 2 - *.login.yahoo.com Remote Code Execution 遠端代碼執行漏洞
Two Yahoo login subdomains ran a Struts2 version vulnerable to S2-016, where redirect prefixes were not filtered and allowed OGNL expressions to be evaluated. The author bypassed a server-side filter and executed system commands, confirming remote code execution.
blog.orange.tw
Published on blog.orange.tw
出問題的原因在於這� �個網站撰寫時是使用了 Struts2 這個 Java Framework,今年七月中的時,Struts2 爆發一個嚴重的 Remote Code Execution 等級的漏洞,這個漏洞被官方編號為 s2-016(基本上 Struts2 可以出� 的地方都出過一遍了之後再出事應該也不意外…),大致是說在 Struts2 中支援一些 Prefix 讓程式開發人員可以方便導向如 action, redirect, redirectAction 等,但在處理這些方法時並沒有做好過濾,造成在這之中的� �容可以用 ${ognlexp} 的形式來執行 OGNL 如:
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
What the attacker needed
Target runs vulnerable Struts2 (S2-016); attacker can send crafted requests; bypass the server-side filter
How it was found
- Test the redirectAction prefix with a simple arithmetic OGNL expression to see if the server evaluates it.
- Use the #request variable to inspect the server's library path and other sensitive information.
- Probe with blind tests to identify which patterns the server-side filter blocks.
- Rewrite the S2-016 exploit to avoid commas, double quotes and blocked keywords, and use OGNL static methods.
- Confirm code execution with a payload that makes the server sleep for ten seconds.
- Run the uname command and send its output back to the author's own server.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The websites used an old Java web framework called Struts2 that had a known flaw: certain redirect options let a user's input be treated as a small program and run on the server. The author found a filter blocking the usual attack, worked around it, and proved they could run commands on Yahoo's machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.