Recipe 15-3: Hooking Malicious Clients with BeEF
This recipe shows you how to hook malicious clients with the Browser Exploit Framework (BeEF) tool for monitoring purposes.
Ingredients
- ModSecurity
- SecContentInjection directive
- SecStreamOutBodyInspection directive
- STREAM_OUTPUT_BODY variable
- @rsub operator
- BeEF
This final recipe demonstrates an advanced response action that is simultaneously the most interesting and most controversial one presented in this book. The response actions described thus far mainly have focused on stopping the malicious traffic itself. Although this approach has some merit, it essentially treats the symptom of the problem (the attack) rather than the problem itself (the attacker). The response action in this recipe shows you how you can use ModSecurity to inject the BeEF application into malicious client web browsers. Before we dive into the details, we should look at an overview of BeEF.
What Is BeEF?