De-mystifying Google’s hottest binary protocol Prasanna Kanagasabai Jovin Lobo.

Slides:



Advertisements
Similar presentations
C Language.
Advertisements

MOD III. Input / Output Streams Byte streams Programs use byte streams to perform input and output of 8-bit bytes. This Stream handles the 8-bit.
General introduction to Web services and an implementation example
SOAP.
CSCI-1680 RPC and Data Representation Rodrigo Fonseca.
Snejina Lazarova Senior QA Engineer, Team Lead CRMTeam Dimo Mitev Senior QA Engineer, Team Lead SystemIntegrationTeam Telerik QA Academy SOAP-based Web.
COE Computer Organization & Assembly Language
An Introduction to APR 2.0 Christian Gross Consultant Montreal, Canada.
Portable binary serialization, the Google way
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
The Analytical Engine Module 6 Program Translation.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
W3af LUCA ALEXANDRA ADELA – MISS 1. w3af  Web Application Attack and Audit Framework  Secures web applications by finding and exploiting web application.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
V Avon High School Tech Club Agenda Old Business –Delete Files New Business –Week 18 Topics: Intro to HTML/CSS: Questions? Summer Work Letter.
Data Formats CMSC 491 Hadoop-Based Distributed Computing Spring 2015 Adam Shook.
CSCI-1680 RPC and Data Representation Rodrigo Fonseca.
Avro Apache Course: Distributed class Student ID: AM Name: Azzaya Galbazar
ICS611 Introduction to Compilers Set 1. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
CIS Computer Programming Logic
Introducing Axis2 Eran Chinthaka. Agenda  Introduction and Motivation  The “big picture”  Key Features of Axis2 High Performance XML Processing Model.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Python: An Introduction
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
CS266 Software Reverse Engineering (SRE) Reversing and Patching Java Bytecode Teodoro (Ted) Cipresso,
File I/O Static void Main( ) {... } data. Topics I/O Streams Reading and Writing Text Files Formatting Text Files Handling Stream Errors File Pointers.
Input & Output In Java. Input & Output It is very complicated for a computer to show how information is processed. Although a computer is very good at.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
Generic API Test tool By Moshe Sapir Almog Masika.
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
ArcGIS Server for Administrators
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
INT-5: Integrate over the Web with OpenEdge® Web Services
By Rachel Thompson and Michael Deck.  Java.io- a package for input and output  File I/O  Reads data into and out of the console  Writes and reads.
Compressed Abstract Syntax Trees as Mobile Code Christian H. Stork Vivek Haldar University of California, Irvine.
CORBA Common Object Request Broker Architecture. Basic Architecture A distributed objects architecture. Logically, an object client makes method calls.
COS 461 Recitation 7 Remote Procedure Calls. Let’s Look at Layers Again.
Cross Language Clone Analysis Team 2 October 13, 2010.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
ASP.NET Web Services.  A unit of managed code installed under IIS that can be remotely invoked using HTTP.
A brief introduction to javadoc and doxygen. What’s in a program file? 1. Comments 2. Code.
Introduction to Combinational Verilog EECS270 rev 9/25/12.
Software Development Introduction
Understanding Character Encodings Basics of Character Encodings that all Programmers should Know. Pritam Barhate, Cofounder and CTO Mobisoft Infotech.
Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Chapter 3: Using Classes and Objects Coming up: Creating Objects.
Prepared by Dr. Jiying Zhao University of Ottawa Canada.
Introduction  “M” “V” “C” stands for “MODEL” “VIEW” “CONTROLLER”. ASP.NET MVC is an architecture to develop ASP.NET web applications in a different manner.
Implementation of Least Significant Bit Image Steganography and its Steganalaysis By: Deniz Oran.
ICS312 Introduction to Compilers Set 23. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Apache Avro CMSC 491 Hadoop-Based Distributed Computing Spring 2016 Adam Shook.
FPL FAST Tech Summit London January FAST Technical Crash course public CFASTSerdes() { } /// /// Gets the presence map for a tag. /// /// CODEC being.
Pyragen A PYTHON WRAPPER GENERATOR TO APPLICATION CORE LIBRARIES Fernando PEREIRA, Christian THEIS - HSE/RP EDMS tech note:
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
Content Coverity Static Analysis Use cases of Coverity Examples
Basic Concepts: computer, program, programming …
Morgan Kaufmann Publishers
PYTHON: AN INTRODUCTION
CHAPTER 5 JAVA FILE INPUT/OUTPUT
Introduction to javadoc
Operation System Program 4
JSP Directives 1-Jan-19.
CSCI-1680 RPC and Data Representation
CHAPTER 1 Introduction Chapter objectives: Understand what Android is
Fundamentals of Python: First Programs
Introduction to Static Analyzer
Introduction to javadoc
ASN.1 Compiler for text-based protocols!
Introduction to Computer Science
Presentation transcript:

De-mystifying Google’s hottest binary protocol Prasanna Kanagasabai Jovin Lobo

About us :  Prasanna Kanagasabai :  Security ThoughtWorks  Member of null- The Open Security Community.  Author of IronSAP a module over IronWASP.  nullcon-Delhi, Clubhack, IIT Guwahati and various null meetups.  Jovin Lobo :  Associate Aujas Networks  Member of null- The Open Security Community.  Author of GameOver – Linux distro for learning web security.  Spoken at nullCon, GNUnify before.

Agenda  Introduction.  Anatomy of Protobufs  Defining Message formats in.Proto files.  Protobuf compiler  Python API to read write messages.  Encoding Scheme  Problem Statement.  Decoding like-a-pro with IronWasp ‘Protobuf Decoder’.

Introduction:  Protocol Buffers a.k.a Protobufs :  Protobufs are Google's own way of serializing structured data.  Extensible, language-neutral and platform- neutral.  Smaller, faster and simpler to implement.  Java, C++ and Python

Anatomy:  Over view :

Defining a.Proto file.  #> less Example.proto message Conference { required string conf_name = 1 ; required int32 no_of_days = 2 ; optional string = 3 ; } // * 1,2,3 are unique tags. These are used by the fields in binary encoding. * For optimization use tags from 1-15 as higher nos. will use one more byte to encode.

Compiling  Syntax:  protoc –I=$_input_Dir --python_out=$_out_Dir $_Path_ProtoFile  Eg:  protoc –I=. --python_out=. Example.proto This will generate a Example_pb2.py file in the specified destination directory.

$ProtoFile_pb2.py  The Protobuf compiler generates special descriptors for all your messages, enums, and fields.  It also generates empty classes, one for each message type:  Eg:

Reading and writing messages using the Protobuf binary format :  SerializeToString()  serializes the message and returns it as a string.  ParseFromString(data)  parses a message from the given string.

Demo: Protobuf… how it wrks

Encoding.  example2.proto message Ex1 { required int32 num = 1; // field tag }  Code snippet: obj = example2_pb2.Ex1(); obj.num = 290; // field value obj.SerializeToString();  Output : 08 A2 02 #hex #binary

Problem statement.

This is what freaked him out 08 A

Lets Decode it..  Step 1 :  Find the wire type.  Step 2:  Find the field number.  Step 3:  Find the field tag.

Step1: finding wire type.   To find wire type take the first byte:   [0] Drop MSB from First byte.  The last 3 bits give wire type.  Wire type is 000  type = 0 is Varint.

Wire types

Step 2: Field tag.  What we already have is  Now we right shift value by 3 bits and the remaining bits will give us the field tag.   ‘0001 ‘ i.e. ‘ 1’  So we get the field tag = 1

Step 3: Find the field value   We drop the 1 st byte   Drop the MSB’s from each of these bytes    Reverse these bytes to obtain the field value.   i.e = 290  So we finally get the value of the field = 290.

So we successfully decoded  example2.proto message Ex1 { required int32 num = 1; }  Code snippet: obj = example2_pb2.Ex1(); obj.num = 290; obj.SerializeToString();  Output : 08 A2 02 #hex #binary  We successfully Decoded Value : “290”

Demo : Lets do this live

Automating all this with IronWasp Protobuf Decoder:  About IronWasp :  IronWasp is an open-source web security scanner.  It is designed to be customizable to the extent where users can create their own custom security scanners using it.  Author – Lavakumar Kuppan  Website :

ProtoBuf Decoder

Road Map for Protobuf Decoder

Hmmm … Decoding ……

Any Questions ? Done … It says ……

Any Questions ? Done … It says ……

Thank You