Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

AMF Testing Made Easy! DeepSec 2012

Despite the popularity of Adobe Flex and the AMF binary protocol, testing AMF-based applications is still a manual and time-consuming activity. This research aimed at improving the current state of art, introducing a new testing approach and a new tool named Blazer. Blazer has been proven to significantly improve the coverage and the effectiveness of AMF security testing, in order to find real-life vulnerabilities including direct object reference bugs, authentication flaws, business logic abuses, SQL injections and other critical bugs. These are the things you are looking for when it comes to security testing.

  • Login to see the comments

AMF Testing Made Easy! DeepSec 2012

  1. AMF Testing Made Easy!DeepSec 2012 Luca Carettoni
  2. AgendaAMF specification, BlazeDS, current techniques and toolsBlazer architecture, core techniques, heuristicsTesting with Blazer Objects generation and fuzzing *DEMO*CVE-2012-3249, Fortify Privileged Information DisclosureFinding vulnerabilities with Blazer Unauthenticated methods *DEMO* SQL Injection *DEMO*What’s new in Blazer v0.3Conclusion
  3. Thanks!Matasano Security - Part of this research was performed on behalf of Matasano SecurityDafydd Stuttard - Burp, such an amazing tool
  4. I am a doer. And you?Luca Carettoni - luca@addepar.comReinventing the Infrastructure that Powers Global WealthManagement -
  5. Introduction and contextAdobe Flex Framework for building Rich-Internet-Applications Based on Adobe FlashActionScript ActionScript is an object-oriented programming languageAction Message Format (AMF) Introduced with Flash Player 6 Compact binary format to serialize ActionScript objects Fast data transfer, comparing to text-based protocols An efficient mechanism to: Save and retrieve application resources Exchange strongly typed data between client-server
  6. AMF for end-users
  7. AMF for old-school hackers
  8. AMF for web hackers
  9. AMFv0 versus AMFv3Flash Player 6 Flash Player 9Object instances can be sent by Object instances, traits and strings canreference be sent by referenceSupport for ActionScript 1.0 Support for new ActionScript 3.0 data types Support for flash.utils.IExternalizable Variable length encoding scheme for integers
  10. Adobe BlazeDSServer-side Java Remoting/Messaging technologyUsing Flex Remoting, any Flex client or AIR application can communicate withremote services and inter-exchange dataIn practice, clients invoke Java methods from classes deployed within a traditionalJ2EE application server (e.g. Apache Tomcat)A widely deployed implementationMultiple alternatives exist: Java: Adobe LiveCycle Data Service, Granite, ... Others: RubyAMF, FluorineFX, amfPHP, ...
  11. Action Message Format (AMF)AMF request/response types: CommandMessage RemotingMessage ....Client-Server communication through channels: Endpoint - http://<host>/messagebroker/amf Destination Service - echoService Operation - String echo(String input)
  12. State of art (research, tools)Testing Flash Applications, OWASP AppSec 2007 - Stefano di PaolaFlex, AMF3 And Blazeds - An Assessment, Blackhat USA 2008 - Jacob Karlsonand Kevin StadmeyerDeblaze, Defcon 17 - Jon RosePentesting Adobe Flex Applications, OWASP NY 2010 - Marcin WielgoszewskiStarting from v1.2.124, Burp Suite allows to visualize and tamper AMF trafficOther debugging tools Charles Proxy, WebScarab, Pinta AIR app, ...
  13. Testing remote methods, todayTraffic inspection and tampering Using network packet analyzers Using HTTP proxiesEnumeration (black-box testing) Retrieving endpoints, destinations and operations from the traffic Decompiling the Flex application Brute-forcing endpoint, destination and operation names
  14. Life is pain, highness.Anyone who tells you differently isselling something W. Goldman
  15. Is this the best we can do?Ideal for black-box testing, limited knowledge requiredTime consumingRequires to invoke all application functionalitiesWhat about custom objects?What about “hidden” services?How to ensure coverage?
  16. Enterprise-grade applicationsLarge attack surfaceCustom externalizable classesI’ve tested applications with more than 500 remote invokable methodsand more than 600 custom Java objects
  17. Life is not #ffffff and #000000
  18. BlazerCustom AMF message generator with fuzzing capabilitiesMethod signatures and Java reflection are used to generate dynamicallyvalid objects
  19. Blazer v0.3 - DeepSec editionGUI-based Burp Suite plugin Well-integrated so you won’t need to leave your favorite tool Burp Free and Pro With Nimbus look’n’feel tooGNU GPL software Burp with java -classpath Blazer_v0.3.jar:burp.jar burp.StartBurp andlaunch Blazer from the context menu
  20. Blazer - ArchitectureA packet generator based on Adobe AMF OpenSource librariesAn object generator to build valid application objects using “best-fit” heuristicsA lightweight fuzzing infrastructure to generate attack vectors, insert payloads within objects, manage multiple threads and monitor the progress
  21. Blazer as a “custom” AMF clientBy default, Blazer uses Burp Proxy to record requests and responses Proxy setting option availableUsing Burp, you can benefit from all built-in tools available (search, sorting, ...)
  22. It’s show time! General usage Objects generation Finding bugs with Blazer: (a) discover exposed methods
  23. CVE-2012-3249HP Fortify Software Security Center Remote Disclosure of Privileged Information Discovered in June 2012, Patched in August 2012From the advisory that I sent to HP:“An AMF endpoint used by the HP Fortify SSC web front-end allows to retrievesensitive system details, including user.dir,,, java.vm.vendor,version, os.version, user.home,, user.language,,os.arch, java.runtime.version,, java.version, ...”public ListResult getFederations(@PName("spec") SearchSpec spec)
  24. Testing HP Fortify SSC
  25. Blazer - Core techniquesObjects generation Java reflection “Best-fit” heuristics Randomness and permutations
  26. Blazer - Data poolsData Pools Containers for “good” user-supplied input Allow to instantiate objects and invoke methods with semantically valid data Available for all primitive types and String Require to be customized for the targetAttack vectors Relevant for String objects only Attack vector’s probability allows to unbalance the String data pool with attack vectors
  27. Blazer - Heuristic
  28. Test case: SQL injection
  29. Blazer - “Best-fit” heuristics 1/2 For example, let’s build a HashMap ObjectGenerator tCObj = new ObjectGenerator(task, null); tCObj.generate(“java.util.HashMap”); INT 1 2 3
  30. Blazer - “Best-fit” heuristics 2/2{null,null}{FOO=BAR,null} STRING FOO BAR ‘;--
  31. It’s show time, again! Finding bugs with Blazer: (b) SQL Injection
  32. Coverage and ScalabilityWith unlimited time, you could get theoretically close to 99.9% coverageIn practice, Blazer and target setup are crucial Optimize the number of permutations Balance “good” and “bad” attack vectorsLet’s do some math: Application with ~500 exposed operations 45 attack vectors (Burp’s default fuzzing list in Intruder) 35 permutations (average for big apps, experimentally determined) ~500 x 45 x 35 = ~787500 reqs
  33. So, what’s new in Blazer 0.3 ?Import of classes and Java source codeCustom Java Security Manager to protect ObjectGenerator.generate()Export functionality (AMF2XML)
  34. ConclusionsDuring real-life assessment, the approach has been proven to increasecoverage and effectivenessBlazer was designed to make AMF testing easy, and yet allowsresearchers to control fully the entire security testing processFrom 0 to message generation and fuzzing in just few clicksIf you find bugs using Blazer, either credits or buy a beerIf you find bugs in Blazer and provide a patch, I’ll buy you a beer
  35. AMF 3 Specification, Adobe Systems Inc. References BlazeDS Developer Guide, Adobe Systems Inc. Java AMF Client, Adobe Systems Inc. Flash Applications, Stefano di Paola Flex, AMF 3 and BlazeDS: An Assessment, Jacob Karlson and Kevin Stadmeyer _Stadmeyer_vSubmit1.pdfDeblaze, Jon Rose Adobe Flex Applications, Marcin Wielgoszewski Suite v1.2.14 Release Note, PortSwigger Ltd.
  36. Pictures