Loopback Address
Table of Contents
A reserved IP address that routes traffic back to the same device without leaving the network stack. Used for testing local services and inter-process communication. Traffic sent to a loopback address never reaches a physical network interface.
Related: IP Address ICMP Networking MOC
Addresses
| Version | Address | Range |
|---|---|---|
| IPv4 | 127.0.0.1 |
Entire 127.0.0.0/8 range is loopback |
| IPv6 | ::1 |
Single address |
localhost resolves to 127.0.0.1 (or ::1) via the hosts
file — not DNS.
Uses
- Testing a locally running web server or API without exposing
it to the network (
http://localhost:8080) - Inter-process communication between services on the same host
- Verifying the local network stack is functional
- Binding services that should not be externally accessible
Security Relevance
— Services bound to 127.0.0.1 only are not accessible from the network — a common pattern for databases (Redis, MySQL) that should only be accessed by local applications — If a service is bound to 0.0.0.0 instead of 127.0.0.1 it is accessible on all interfaces — frequent misconfiguration finding — SSRF can reach localhost services that are not exposed externally — the application becomes a proxy to internal services the attacker cannot reach directly
Tips
127.0.0.1andlocalhostare not always identical — if the hosts file or DNS is manipulated,localhostmay resolve elsewhere; use the IP directly when certainty is needed- Services binding to
127.0.0.1are not reachable via SSRF from an external attacker unless the SSRF runs server-side on the same host — which it does, making localhost a primary SSRF target