보안/웹 해킹_보안

[WebGoat 5.4-06] Concurrency

오픈이지 2013. 4. 7. 11:49


1. Thread Safety Problems


동시성에 대한 취약점을 가진 웹어플리케이션은 같은 시간에 같은 함수를 실행하기 시도하는 다른 사용자에게 로그인 정보를 보여줄 수 있다.

 

[해답]

두개의 브라우저를 열어 한쪽은 "jeff"를 다른 창에는 "dave"를 입력한뒤 두개 창의 값을 1.5초안에 전송한다. dave를 먼저 전송하고 연달아 jeff를 전송하면 두개의 브라우저에 jeff에 대한 정보가 출력된다.

 

     

2. Shopping Cart Concurrency Flaw


쓰레드의 취약성을 보여준다.

쇼핑몰에서 장바구니 기능과 결제 기능이 있다.

장바구니 기능은 사용자가 현재 구매하려는 물품을 담아 결제전에 계산해 보려는 목적으로 제공된다.

결제는 현재 구매하려는 물품을 담아 결제 전에 계산해 보려는 목적과 선택한 물품들을 적당한 비용을 지불하고 구매하려는 목적으로 사용된다.

하지만 이 두개의 기능의 스레드가 분리되어 있지 않은 경우 심각한 문제가 발생하게 된다.


[해답] 

두개의 창을 연다.

첫번째창에서 169달러 물품을 1개사서 [Purchase]버튼을 클릭한다.

두번째창에서 169달러 물품을 10개 선택하고 장바구니를 업데이트 한다.

다시 첫번째창으로 가서 결재창에서 [Confirm]을 클릭하면 10개를 169달러에 구매하게 된다.

 

장바구니에 있던 정보가 스레드가 바뀌면서 넘어가게 되어 물품정보만 갱신되고 가격정보는 갱신되지 않아서 물품을 90%할인된 가격으로 구매할 수 있게 된 것이다.

 

자바소스를 보면 TOTAL값과 주문수량등이 클래스 멤버변수로 선언되어 스레드간에 공유 가능한 데이터로 설정되어 있는 것을 볼 수 있다.

 

 


OWASP WebGoat: Concurrency 솔루션 비디오 보기  [View | Download]   

Description: It includes Threat Safety Problem and Shopping Cart Concurrency Flaw which are commonly caused due to the improper use of Java Static methods. Web applications can handle many HTTP requests simultaneously. Developers often use variables that are not thread safe. Thread safety means that the fields of an object or class always maintain a valid state when used concurrently by multiple threads. It is often possible to exploit a concurrency bug by loading the same page as another user at the exact same time. Because all threads share the same method area, and the method area is where all class variables are stored, multiple threads can attempt to use the same class variables concurrently. 
Size: 6.24 MB