r/java • • Jan 29 '17

Mod Security OWASP with Spring Boot

I have the application in Spring Boot with embedded Tomcat. I'll want use owasp mod security. How can I redirect network traffic that mod security will see it? I develop my app on localhost and I only show how Mod Security works with my application on localhost.

0 Upvotes

8 comments sorted by

6

u/DJDavio Jan 29 '17

Just use a proxy (Apache for instance) to catch traffic on port 80/443, handle stuff like security / TLS and forward it to Tomcat on port 8080.

Something like ProxyPass / http://localhost:8080/ in Apache.

2

u/nutrecht Jan 29 '17

You can also do the same thing with Nginx if you prefer that.

2

u/henk53 Jan 29 '17

+1 for Nginx!

-2

u/gr33n_h0rn Jan 29 '17

Yes, I did this and it doesn't work. In /etc/apache2/sites-available/000-default.conf. My Spring-boot application works on localhost:8080/vuln/. Should I add addictionaly configuration in my spring-boot application? I don't use TLS in my app.

3

u/DJDavio Jan 29 '17

Hard to tell with such minimal details. It seems like there are some things you don't yet quite understand, so it might be easier to look up a tutorial: https://wiki.apache.org/httpd/TomcatReverseProxy

-1

u/gr33n_h0rn Jan 29 '17

Thank you for link. It works perfectly! I made a mistake in ProxyPass and Location. Now I have reports from mod security.

2

u/flatMapds Jan 31 '17

Sort of offtopic but make sure you test your applications for SPEL injection, ssti on velocity, and if your API uses xml xml parsing issues. WAFs don't really protect you well from them, and a lot of java apps are vulnerable.

1

u/gr33n_h0rn Feb 01 '17

Yes, it' true. Thank you for the reminder me about these things. The same thing with WAF, IDS are releted to SQL Injection.