Brace for your next Race - Race conditions in Servlets and Controllers
summary
Demonstrates a real race on a Spring MVC controller and J2EE servlet where a shopping-basket coupon handler subtracts the discount multiple times; a local demo sends ~300 concurrent requests with Turbo Intruder through Burp Suite and observes four wrong responses (examples: 21.87 or even negative totals). Fixes shown include using ReentrantLock, semaphores or synchronized blocks and switching the bean to @Scope("request"); locks eliminate the duplicates but add contention and potential performance costs.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:30Survey
- 2:17Who am I
- 3:09Agenda
- 4:16Race conditions
- 5:15What are race conditions
- 8:07Race conditions in Security
- 10:41Coupon application
- 14:43Example code
- 18:58Running the Trace
- 25:21Basket Controller
- 29:04Other approaches
- 32:23Scope Prototype
- 35:32Conclusion
related talks
01h 24mFastest Servlets in the West?
01h 01mReactive web services
01h 11mServlet or Reactive Stacks: The Choice is Yours. Oh No... The Choice is Mine! - Rossen Stoyanchev
46mServlet 4 0: A New Twist on an Old Favorite
42mA Race To The Bottom: Database Transactions Undermining Your AppSec
38mSmashing the State Machine: The True Potential of Web Race Conditions
37mDataBinding2Shell: Novel Pathways to RCE Web Frameworks
44mSmashing The State Machine: The True Potential Of Web Race Conditions
