Reverse engineering an API (2024)

Gain a deeper understanding of a public or private API, especially for ones that aren’t well-documented

Reverse engineering an API (3)

When you think about reverse engineering an API, perhaps corporate espionage or something legally or ethically questionable comes to mind. Hackers gonna hack. However, there’s also legitimate reasons for reverse engineering an API.

APIs aren’t always documented. When you’re debugging an API, you can diagnose and resolve issues more quickly when you can visualize all the data that is sent and received. Doing this allows you to gain a deeper understanding of an API.

Reverse engineering, also called back engineering, is the process by which a man-made object is deconstructed to reveal its designs, architecture, or to extract knowledge from the object.

Knowing how an API actually behaves enables you to identify flaws and security vulnerabilities like accidental data leakage. This also performance tests your API so you can isolate bottlenecks that could benefit from additional caching and compression.

Of course, there’s also selfish reasons for reverse engineering an API.

When you’re reverse engineering a private API that isn’t yours, make sure to check the terms of service. Some developers wear their cease and desist orders like a badge of honor, but you might get sued or banned from their services.

A web proxy server is like a middleman that sits between your client application and the server. The web proxy is a substitute server that can intercept HTTP traffic between a web browser and the website’s real server.

It’s all there! Black and white, clear as crystal!

— Willy Wonka, The Chocolate Factory

Reasons to use a web proxy

  • Monitor and eavesdrop on HTTP network traffic by recording and displaying all traffic between your client and server
  • Hide your public IP address while browsing websites and to access blocked content
  • Filter or redirect requests to limit access to content or optimize systems performance
Reverse engineering an API (4)

Free web proxy tools

  • Postman is a free tool with a bunch of different proxies, including a built-in proxy to capture HTTP requests in the native apps for Mac, Windows, or Linux
  • Mitproxy is an open-source proxy with a command line interface, web interface, and Python API
  • Fiddler is a free web debugging proxy with support for a wide variety of browsers, systems, and platforms
  • Burp has a free community edition of a web proxy server that lets you view and modify requests and responses

The remainder of this article will focus on how you can use Postman to intercept the traffic between your client and server.

Reverse engineering an API (5)

It’s time to get our hands dirty, sniffing and inspecting to our heart’s content. First, we’ll import a single request into the Postman app. Then we’ll use Postman as a proxy to capture a stream of HTTP/S requests from a variety of clients like a desktop web browser, a mobile device, and an Electron app.

To follow along in Postman, click the orange +New button in the top left of the Postman app. Under the Templates tab, search for Reverse engineering an API, and import the sample collection into your instance of the Postman app.

Reverse engineering an API (6)

Read through the descriptions in the Postman app for details, or check out the web documentation for step-by-step instructions and screenshots.

Reverse engineering an API (7)

Import a single request

If you want to inspect a request in Postman, here’s a super simple way to import it as cURL from your browser. In this example, we will use Chrome DevTools to inspect and select a request. You can follow similar steps when using other web browsers.

Reverse engineering an API (8)
Reverse engineering an API (9)

Inspect a stream of requests

If you want to inspect a stream of requests from your client, you can use the Postman built-in proxy to capture these requests. Postman has a bunch of different proxies. In this scenario, we’ll rely on the Postman built-in proxy in the native apps for Mac, Windows, or Linux. You can capture requests sent from your client, like a desktop web browser, mobile device, or an Electron app.

You can pipe this stream of requests to your Postman History and save them to a Postman Collection. Then you can revisit these requests for inspection at a later date, or share them with a teammate.

Reverse engineering an API (10)

Currently, the Postman built-in proxy in the native apps only captures HTTP request traffic. Fortunately, most websites have HTTP Strict Transport Security (HSTS) enabled for an additional layer of security. Unfortunately, this means the Postman built-in proxy cannot capture requests sent over HTTPS if the website has HSTS enabled.

Note: As of the publication of this article, the Postman built-in proxy captures HTTP traffic, but not traffic from HTTPS websites with HSTS enabled. Interceptor integration and HTTPS proxy is slated for development in the Postman roadmap for developers.

This recipe is just the tip of the iceberg of how you can sniff and inspect HTTP traffic to start understanding what’s going on under the hood. For tougher nuts to crack, you may have to dig into SSL certificate pinning, spoof particular client attributes, or learn how to sign and authenticate more complex requests.

Although these tools and methods are powerful and can be used for selfish reasons, they can and should be used for good.

Be excellent to each other.

Bill S. Preston, Esq.

Tools like Postman can enhance the visibility of client requests, making them easier to replicate and tweak, so you can diagnose and resolve issues faster. Ultimately, this will help you gain a deeper understanding of a public or private API, especially for APIs that aren’t well-documented.

Reverse engineering an API (2024)

FAQs

What is a reverse API? ›

On the other hand, Webhook, also called reverse API, web callback, or an HTTP push API, is a way for an app to provide other applications with real-time information. It delivers data as an event happens or almost immediately. ​​APIs are request-based, meaning they operate when requests come from 3rd party apps.

What are some examples of reverse engineering? ›

Reverse engineering examples

Computer engineers could reverse engineer a computer or its parts to learn how to build one. This may be helpful for people who are new to building computers. A computer engineer could also disassemble a computer to replace its parts with newer pieces or run tests on a broken part.

What does it mean to reverse engineer an app? ›

Reverse engineering is the process of reconstructing the semantics of a compiled program's source code. In other words, you take the program apart, run it, simulate parts of it, and do other unspeakable things to it to understand what it does and how.

Is it illegal to reverse engineer an API? ›

In California, reverse engineering does not prove to be a wrongful act in the eyes of law, and similarly in Texas, unless reverse engineering is not prohibited, it is considered as a “fair and legal means” to obtain information.

Is an API a reverse proxy? ›

We can think of the Gateway API as a superset of a Reverse Proxy. Following, we will discuss the additional capabilities it has to offer. Firstly, the API Gateway hides to the clients how the backends are partitioned in the architecture. Not only by forwarding requests but possibly performing orchestration/aggregation.

What are the 5 steps of reverse engineering? ›

What Are the Steps of the Reverse Engineering Process?
  • Prescreening. First, you must identify what you are going to reverse engineer. ...
  • Research. This step is particularly important when engineers do not have the original product on hand. ...
  • Disassembly. ...
  • Analyze and Evaluate. ...
  • Reassembly. ...
  • Creation.
Oct 29, 2022

How do you explain reverse engineering? ›

Reverse engineering, sometimes called back engineering, is a process in which software, machines, aircraft, architectural structures and other products are deconstructed to extract design information from them. Often, reverse engineering involves deconstructing individual components of larger products.

What is another name for reverse engineering? ›

Reverse engineering (also known as backwards engineering or back engineering) is a process or method through which one attempts to understand through deductive reasoning how a previously made device, process, system, or piece of software accomplishes a task with very little (if any) insight into exactly how it does so.

Why do hackers use reverse engineering? ›

Reverse engineering allows hackers to understand the best ways to steal information by spotting common security problems. These malicious agents look at the machine code an app generates to figure out the underlying processes.

How do hackers use reverse engineering? ›

Hackers often use reverse engineering to find vulnerabilities in systems and devices. In many cases, hackers will obtain a copy of the software or hardware they want to attack. They will disassemble it, looking for ways to bypass security features or exploit weaknesses.

Can an app be reverse engineered? ›

However, with the right tools and expertise, it is possible to reverse engineer most Android applications successfully.

What is a famous example of reverse engineering? ›

A famous example of reverse-engineering involves San Jose-based Phoenix Technologies Ltd., which in the mid-1980s wanted to produce a BIOS for PCs that would be compatible with the IBM PC's proprietary BIOS. (A BIOS is a program stored in firmware that's run when a PC starts up; see Technology QuickStudy, June 25.)

Is it illegal to reverse engineer software? ›

For software, attackers may reverse engineer to find a weakness in the software, and through exploiting the vulnerabilities, the attackers can create malware. Reverse engineering is generally legal.

What are the 4 steps of reverse engineering? ›

5 steps for reverse engineering
  • Gather information. The first step in backward engineering is collecting information about the product. ...
  • Develop a model. After gathering information about the product or part, the engineers can create a sketch or model of it. ...
  • Disassemble the product. ...
  • Evaluate the product. ...
  • Reassemble.
Sep 30, 2022

Why are webhooks called reverse API? ›

Since the application sending the data initiates the transfer, webhooks are often referred to as "reverse APIs."

What is the difference between API and callback API? ›

APIs send data when requested, but callbacks can send data when an event is triggered to the callback url. So the client doesn't need to check repeatedly, if new data is available. e.g. When a Callback API is called, the responder must handle the request and provide a response that conforms to what the caller expects.

What is opposite of REST API? ›

Streaming APIs are totally the opposite of REST APIs. They are simply a long-running request, left open, so data can be pushed into it. When they are updated, the user is provided with the results. These APIs are used for reading data in real time from the web and provide users with precise and up-to-date information.

Can an API be bidirectional? ›

Some API-enabled products allow you to read from them, but not write into them. A Bi-Directional API will give you both options, and empower you to control most—if not all—aspects of the underlying behavior.

Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 6006

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.