Major flaw in Java-based Spring Framework allows remote-code execution
networkworld.com
networkworld.com
https://twitter.com/AlBaker_Dev/status/292415396684918784
"That was fixed in 2011, Spring 3.0.6 and 2.5.6SEC03, enjoy!"
And here's an overview for all Spring modules: http://support.springsource.com/security/springsource-all
see http://www.h-online.com/open/news/item/The-ghost-of-a-Spring...
No framework is invulnerable against idiot programmers.
the programmer is not evaluating unvalidated text. the programmer is only displaying it. the bug in spring is causing the unexpected, additional evaluation.
see, for example, section 3 of https://docs.google.com/document/d/1dc1xxO8UMFaGLOwgkykYdghG...
http://www.coderanch.com/t/489232/Spring/spring-message-tag-... See that ? Nobody is using request parameters because that would be fucking stupid. This is a an Expression Evaluation Engine --- it evaluates expressions. Every programmer who uses this knows this.
Please stop spreading the FUD!
I expect ${param['message']} to be evaluated to a string, then the string to be used to look up a message. What I don't expect is the string to be evaluated again... Why would I?
I'm missing what new discovery they've made, beyond the misleading count of how many people have downloaded the jars from a maven repository.
Here's the original article:
http://www.mindedsecurity.com/fileshare/ExpressionLanguageIn...
(expression language can be used elsewhere, but it's not so common and much less likely to received user-supplied parameters)
also, this article http://www.h-online.com/open/news/item/The-ghost-of-a-Spring... is much clearer about affected versions (3.0.5 and below are bad; 3.0.6 can be fixed via config; 3.1 is ok)
this does not require explicit evaluation. it can occur when you were only trying to display the data.
it is a serious bug, not a stupid programming mistake.
find apache-tomcat-7.0.23/ -name "spring*.jar"
should show things like: apache-tomcat-7.0.23/webapps/bss/WEB-INF/lib/spring-beans-3.1.1.RELEASE.jar
apache-tomcat-7.0.23/webapps/bss/WEB-INF/lib/spring-core-3.1.1.RELEASE.jar
apache-tomcat-7.0.23/webapps/bss/WEB-INF/lib/spring-expression-3.1.1.RELEASE.jar
and you need to worry if those version numbers are 3.0.6 or lower. you only really need to worry about the expression language, which is the last one, but i cannot promise it is named the same in other versions.also, this assumes that the project was built with maven or otherwise uses standard jar names. if the jar was hand-rolled and named then it could look like anything... (in which case applicationContext.xml, as suggested elsewhere, at least warns you it's spring).
spring-beans and spring-core are the fundamental building blocks of most Java EE applications and using them in no way causes the aforementioned vulnerability.
The only case that causes this vulnerability is when a JSP page contains this code : <spring:message text="" code="${param['message']}"></spring:message> Any admin can run fgrep or equivalent on all jsps to see if they contain this text <spring:message text="" code="${param
And if you use a templating engine that uses these tags you'd have to trace whether they are invoked anywhere... So it's not as simple as a grep at all.
...do real world Spring web apps really use unsanitized user input with "expression language" queries? (or am I totally missing the point? - not a Spring guy, I admit, but it all reads weird to me)
if i give my name as "$account.increment" then the worst you would expect to happen is that when my name is displayed it appears as "$account.increment". right?
in steps:
the jsp page contains <cout value="$user">
el looks at $user and finds the text "$account.increment" and *displays* that.
this is completely ok and does not require input sanitization. the code does not appear unsafe.but no - there is the possibility that instead of simply displaying the value, spring will (may - i don't understand exactly when this is triggered) evaluate it. in steps:
the jsp page contains <cout value="$user">
el looks at $user and finds the text "$account.increment".
el *evaluates* $account.increment and increments the account. PLOP!
el displays the result of evaluating the account.
again: this occurs when the programmer was only intending to display the value. because spring (by mistake) has a second round of evaluation (first is $user to contents; second is contents to incrementing account), text that should simply be displayed can be evaluated.see, for example https://docs.google.com/document/d/1dc1xxO8UMFaGLOwgkykYdghG...
It seems to follow a particular pattern. Find a bug or bug class in $product. Then start screaming from the rooftops about how the sky is falling without telling people how to stop it or what the problem is. Finally release limited fix info via a mailing list or conference. In the end, everyone loses.
I don't use Java much these days but I am teaching my kids OOP using Java. I'd like to also take the opportunity to show him where the warts are.
Extend it with directory browsing, if you want.
Then, show them the joy of localhost/../../secret/mydiary.txt
I'd suggest doing it with Smalltalk, Ruby or Python. If I had to learn to program with Java, I'd open a restaurant.
http://en.wikipedia.org/wiki/Argumentum_ad_populum
> the fundamentals are the same.
Only if all your fundamentals are restricted to what Java implements. A student that knows only Java may have trouble using multiple inheritance, first-class functions or prototype-based inheritance. I've seen a lot of Java programmers who cannot grasp these ideas and get utterly lost. It's not fun to watch.
The quotes should cover 'not' as well i.e. "not trivial to exploit".
If there is a flaw you probably need to write like 5M of XML to exploit it.