Java, PHP, NodeJS, and Ruby Tools Compromised By Severe Swagger Vulnerability (threatpost.com)
"Researchers have discovered a vulnerability within the Swagger specification which may place tools based on NodeJS, PHP, Ruby, and Java at risk of exploit," warns ZDNet's blog Zero Day, adding "the severe flaw allows attackers to remotely execute code." Slashdot reader msm1267 writes:
A serious parameter injection vulnerability exists in the Swagger Code Generator that could allow an attacker to embed executable code in a Swagger JSON file. The flaw affects NodeJS, Ruby, PHP, Java and likely other programming languages. Researchers at Rapid7 who found the flaw disclosed details...as well as a Metasploit module and a proposed patch for the specification. The matter was privately disclosed in April, but Rapid7 said it never heard a response from Swagger's maintainers.
Swagger produces and consumes RESTful web services APIs; Swagger docs can be consumed to automatically generate client-server code. As of January 1, the Swagger specification was donated to the Open API Initiative and became the foundation for the OpenAPI Specification. The vulnerability lies in the Swagger Code Generator, and specifically in that parsers for Swagger documents (written in JSON) don't properly sanitize input. Therefore, an attacker can abuse a developer's trust in Swagger to include executable code that will run once it's in the development environment.
Swagger produces and consumes RESTful web services APIs; Swagger docs can be consumed to automatically generate client-server code. As of January 1, the Swagger specification was donated to the Open API Initiative and became the foundation for the OpenAPI Specification. The vulnerability lies in the Swagger Code Generator, and specifically in that parsers for Swagger documents (written in JSON) don't properly sanitize input. Therefore, an attacker can abuse a developer's trust in Swagger to include executable code that will run once it's in the development environment.
Never heard of it and not in use in major areas. Nothing to see here. Just overhyped.
Have you heard of von neumann architectures? Did you know that nearly every computer in use today is such a device?
Congratulations to the Swagger team on achieving their impressive goal of officially codifying every RESTful anti-pattern ever invented, and let's wish them all the best in formally implementing every known security hole next.
Save this as a batch file and modify or re-write it for your environment.
Usage:
instructionstocash takes instructions from stdin and outouts the literal string "cash!" to stdout.
--cut here--
#!/bin/sh
#instuctionstocash
echo 'cash!'
--cut here--
Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
Damn typos. Finding and fixing typos is left as an exercise for the reader.
Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
I hadn't see Swagger before, but it looks like a nicer design than previous web service description languages.
The "vulnerability" related to Swagger in some tools that the REST API specification (in Swagger format) into a library that talks to that API. Specifically, malicious specifications can inject code into the library. I don't think this is a major problem in practice. These translation tools are invoked by people who want to write clients for specific services; usually, that means that you know the service provider and understand your trust relationship. In addition, this is not a fully automatic process, since you'll be programming against the library that the tool generates anyway.
Keep in mind that the alternative to a REST specification that the service provider gives you a bunch of REST client libraries, and it's far easier to hide malicious code in those client libraries than in a REST specification.
I don't think it's fair to call this a significant "vulnerability", although it might still be nice if Swagger tools detected these cases and alerted the developer to it.
Microsoft is open-sourcing their stuff now too. Use Windows 7 and disable updates if you want to be safe.
USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
I think swagger is like WSDL using json instead of xml
"The fundamental problem with RPC is coupling. RPC clients become tightly coupled to service implementation in several ways and it becomes very hard to change service implementation without breaking clients"
Which is why RESTful HTTP isn't RPC, because we already know it's the wrong tool for this job. The fundamental problem is that today's web has an entire programming cult[ure] raised on OOP to the point where they're pathologically incapable of imagining any kind of interaction model except synchronous local message passing, so instead of bothering to RTFM until they understand correctly how REST works, the lazy toads simply reinterpret "REST" to mean what they already know. Which is 180 the opposite to what it actually is.
Actually, the best way to think about RESTful interactions is as a form of declarative programming, where you say how you want the state of a remote application to look, and then leave that application to figure out for itself how to transition into that state. That's why HTTP only has verbs for performing state changes; any other behaviors a RESTful application might manifest arise purely as side-effects to those state transitions.
But you try explaining this to a modern industry web developer, not only will they not believe you they won't even understand what words you just said. Dunning-Kruger wept.
Now I'm confused. Should we use Windows 7, or should we use hot grits?
Il n'y a pas de Planet B.
From my fairly basic reading of the issue, it is NOT a problem of ANY of the listed languages, but a problem with using/integrating the Swagger API in your web app using any language.
Sleep your way to a whiter smile...date a dentist!
Seconding this... NEVER heard of Swagger before... At first I thought that was the new hip name FOR this exploit (WHY THE FUCK DO THEY ALL NEED NAMES NOW)
Been there, done that, got the scars to prove it.
I've found that compared to the tooling we were all using 15 years ago to build SOAP web services (fond memories of fighting incompatible implementations...), Swagger tooling is far worse, implements far fewer even obvious use cases, and is laden with bugs. In my recent work, Swagger Codegen was the worst I used. It is a flaming piece of shit which appears to be maintained by the same sort of teenagers with short attention spans that brought you crap like "left pad" on npm.
Even before the now-revealed security bugs, I found it was completely unfit for purpose. Attempting to generate Java server stubs, I could not get the piece of garbage to generate code that could COMPILE. It doesn't handle restriction by simple types, which is quite possibly the SIMPLEST thing you can do with a schema.
Angry that I wasted a day on this garbage. And apologies to anybody who worked on that code who might be reading this. I realise I might be looking a gift horse in the mouth -- but anybody who has the cheek to release such a piece of shit even as Free software and pass it off as a working piece of software ought to be fucking ashamed of themselves. It indicates a profound disrespect for the time and energy of potential users.
Specifically, Swagger Code Generator, which FWIW, is a bit crap to begin with.
Sure you've never seen Swagger UI before? Because just about everyone I've spoke to who's ever dabbled in server-side development is familiar with it:
Demo: http://petstore.swagger.io/
I have never heard of it either,
Looks like another one of those new trendy things that let people who cant program think they can program.
- Just type blipetyblop., and you will have a complete system up and running.
- Oh cool, my boss will be pleased!
- Now type blippty-format-c-blop
- Okidoki...
Oh no, turns out the blipetyblop-framework has a vulnerability!
So the vulnerability, is that people who put unknown code in their systems sometimes gets screwed?
Well, we better fix that then.
The OFA outlines this issue. What they are saying is that because the Swagger is a JSON document, if you use a code generator that simply regurgitates its values without validation, you could end up with code executing in the context of whatever is consuming the API. The issue is with code generators, and not the swagger documentation .
An example they give as an attack on HTML is the following (with angle brackets instead of square ones, obviously):
"info": { "description": "[script]alert(1)[/script]",
I guess the idea is that you have used Swagger code generator to create code to call the RESTful APIs you are interested in. The code generator includes this description (which seems kind of odd) in the generated code, giving you an alert when a page including this code is loaded. They also give an example of attacking the "paths" property (which includes information on what URLs can be used to call specific APIs) which would execute code on the back end. I could see this being more a legitimate problem.
A few things though before we all freak out:
Titles like ZDNet's "Severe Swagger vulnerability compromises NodeJS, PHP, Java" are gratuitous hyperbole. Slashdot's title is a little better because it at least refines the panic to "tools", but still not great. There is an issue here, but the internet is not going to go down in flames over this one.