“Whose Registry Is This”?
An exposed Eureka service registry allowed an attacker to register a fake instance of an existing micro-service pointing to an internal service, bypassing gateway routing restrictions to perform SSRF. Alternatively, registering a malicious external service enabled hijacking of gateway traffic and XSS.
Published on medium.com
Eureka is a service registry used to make micro-services to find each other. What can go wrong if the registry server becomes available from the internet?
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Eureka is Netflix's service registry: a RESTful service that micro-services use to find each other. It is described in the official GitHub repository as a RESTful service used primarily in the AWS cloud for discovery, load balancing and failover of middle-tier servers, playing a critical role in Netflix mid-tier infrastructure. This write-up looks at what happens when the registry itself is reachable from the internet and an attacker can register a micro-service of their own. The two vectors covered are SSRF and internal traffic hijack leading to XSS, both performed at the application layer.
Context
Eureka is a service registry. On startup, each micro-service sends a REGISTER request to the Eureka server, and later sends a STATUS update every N seconds, 30 seconds by default. From this the registry knows how many instances of a particular micro-service are up and what their addresses are; an address can be either DNS or IP.
The registry is not a proxy. It is passive storage holding information about currently running instances. To balance and proxy HTTP requests, the setup uses Spring Cloud Gateway, which collects the same information from the Eureka server to know where it should balance requests.
The test lab has two services on the backend inside the local network, webservice and secretservice. Spring Cloud Gateway (the gateway) is configured to route all HTTP requests to webservice. There is no HTTP route from the gateway to secretservice. The eureka server sits in the DMZ, exposed by mistake, and the user or attacker is on the internet.
In the lab, the gateway handles only one route to webservice:
.route("webservice", r -> r.path("/**") .uri("lb://WEBSERVICE"))
Every path /** that is not registered on the gateway separately is balanced (lb://WEBSERVICE) to the micro-service named webservice. There is no HTTP route to secretservice, so by design the user is not supposed to communicate with it directly. In the wild this could be any internal micro-service that potentially trusts all incoming requests, because a service like secretservice is usually meant only for internal service-to-service communication. In the lab, secretservice contains a flag to extract.
Webservice, for its part, communicates with secretservice internally: it asks the Eureka client to find the secretservice address and then sends a request there. The Eureka client keeps all the information collected from the Eureka server in memory and updates it once per N seconds, 30 seconds by default.
Setup
The lab consists of the two backend services, the gateway, the exposed Eureka server and an attacker on the internet. The researcher also checked how many Eureka servers can be found by Google, noting that the dork could probably be improved:

Conversations with the pentester community suggested that leaving the registry service outside is a common potential security misconfiguration. The lab layout is shown below:

Finding it
The starting observation is that the registry can become a point of failure from a security point of view, and that it is not always properly secured. The main idea behind both attack vectors is changing HTTP routing with some profit for exploitation.
Having access to the registry, an attacker can register a fake service and try to reach it through Spring Cloud Gateway. Once the fake service is registered, the gateway begins to balance requests to it if the right service name was registered. Two consequences follow:
- If an attacker registers a new instance of an existing micro-service and maps it to an internal micro-service that has no public HTTP route, the attacker can send HTTP requests to that service. This is SSRF.
- If the attacker registers a malicious service outside, both the gateway and internal services will send requests to that fake service outside. This allows hijacking a victim's traffic, with XSS, or hijacking internal service connections.
Exploitation
Attack Vector 1: Server Side Request Forgery

Successful exploitation needs a service mapped to the root URL /. This is not strictly a requirement, but it gives more freedom in path walking. In the lab, Spring Cloud Gateway already maps / to webservice.
Step 1: find the target's address
First, find the address of the targeted micro-service (secretservice) on the registry:

Step 2: register a fake instance of webservice
Register a new micro-service with the name webservice but with the address and port of secretservice. To do this, change the ipAddr, hostName and port parameters in the Eureka registration request:

Step 3: let the gateway rebalance and send requests
There are now two instances of webservice. After the gateway syncs information from the registry, it begins to balance attacker requests between the two instances. Because one instance points to secretservice, the route restriction on the HTTP layer is bypassed and the SSRF succeeds. During multiple requests you will see two different pages: a 404 error, because there is no route for /flag on the legitimate webservice, and FLAG{EUREKA_PWNED}:


Attack Vector 2: Traffic Hijack and XSS

In the second scenario, the attacker registers an instance of webservice pointing to a malicious server. The gateway then routes HTTP traffic to the attacker-controlled server. This leads to leakage of secrets such as a token or sessionId, and to XSS. For the browser, because communication with the malicious server happens in the backchannel, it looks like an official site, and TLS on the gateway does not help.

The same trick can be applied to hijack internal service calls, leading to information leakage or more critical vulnerabilities.
How to communicate with Eureka
The registration request itself is not reproduced in the write-up. The guidance is to update the fields app (both in the path and as a parameter), ipAddr and hostname. If that request does not work, for example because the protocol has changed since publication, the easiest way to extract the correct request is to run a simple Eureka client and server locally and capture the traffic with Wireshark, which should take around ten minutes. Any tutorial about the registry works for this, for example the Spring service registration and discovery guide.
Root cause
The registry can be reached from the internet in this lab, and the gateway trusts the registry's contents to decide where to send traffic. Registering an instance of an existing service name with a different address is enough to redirect the gateway's load balancing. The route restriction that keeps users away from secretservice exists only at the HTTP layer of the gateway, so it is bypassed once the gateway itself is made to forward to the internal address. In the second vector, the same trust lets the gateway and internal services send requests to an attacker-controlled host, and because the browser only sees the official site, TLS on the gateway does not protect the backchannel.
Impact
With access to an exposed registry, an attacker can reach internal micro-services that have no public HTTP route, as demonstrated by reading the flag from secretservice. They can also receive traffic intended for a legitimate service, leaking secrets such as tokens or session identifiers and enabling XSS against users, and can hijack internal service-to-service calls, leading to information leakage or more critical vulnerabilities. The write-up notes that in the wild the internal target can be any micro-service that trusts incoming requests, and that the root-URL mapping is not strictly required but gives more freedom in path walking.
Fix
Keeping Eureka off the internet must not be the main defence, because exposure happens anyway. Security should be layered so that if one layer fails through a 0day or misconfiguration, the others still hold.
- Application layer: Eureka supports basic HTTP authentication; use it. Basic authentication is not best practice and means sharing one password between multiple micro-services, but it buys time after an attacker finds an exposed registry.
- Presentation layer: mTLS between micro-services helps against registering a malicious service outside, and therefore against traffic hijack.
- Transport and network layers: micro-segmentation and strict firewall rules. There is no need for network connectivity between the gateway and secretservice, which protects against SSRF, and uncontrolled outbound connections to public networks should be prohibited, which protects against traffic hijacking and reverse shells.
Variants to test
- Register an instance of an existing service name with
ipAddr,hostNameandportpointing at an internal host. A positive result is the gateway returning responses from the internal service, alternating with the legitimate instance's responses. - Register an instance pointing at a host you control and watch for incoming requests from the gateway or from internal services. A positive result is traffic, including tokens or session identifiers, arriving at your server.
- Look for a service mapped to
/on the gateway, which gives more freedom in path walking when targeting internal services. - If the registration request format is unknown or has changed, run a local Eureka client and server and capture the REGISTER request with Wireshark to reproduce the correct fields.
What happened, in plain words
Netflix runs a piece of software called Eureka. Eureka is a service registry: a phone book for programs. In a big system, the work is split across many small programs called micro-services. Each one does one job, for example taking orders, checking passwords or storing files. These programs need to talk to each other, and to do that they need to know each other's addresses. Instead of hard-coding addresses everywhere, each program announces itself to the registry when it starts up, and the registry keeps a list of who is running and where.
Eureka is a RESTful service. That means it is spoken to over ordinary web requests, the same kind your browser makes when it loads a page: a request goes to a URL, and the server answers. The official description in the GitHub repository says Eureka is used primarily in the AWS cloud for discovery, load balancing and failover of middle-tier servers, and plays a critical role in Netflix mid-tier infrastructure.
This write-up asks a simple question: what happens if that phone book is reachable from the open internet, and a stranger can add an entry to it? The answer is two attacks. The first is SSRF (Server Side Request Forgery), where the attacker makes a server send requests to a place the attacker cannot reach directly. The second is traffic hijack leading to XSS (Cross-Site Scripting), where the attacker receives traffic meant for a real service and can run code in a victim's browser. Both attacks happen at the application layer, meaning they use normal web requests. The write-up notes they can be mitigated on the network and transport layers, and ends with defences.
The pieces of the lab
Before the attacks, you need to know what is in the test setup. There are two backend services inside a local network, webservice and secretservice. "Backend" means they are not meant to be reached directly from the internet; they sit behind something else.
- webservice is the service users are supposed to reach.
- secretservice is an internal service. In the lab it holds a flag, a secret string that proves you got in. In real life it could be any internal service that trusts whoever talks to it.
In front of them sits Spring Cloud Gateway, called the gateway. A gateway is a front door: it receives requests from the internet and forwards them to the right backend service. It is configured to send all HTTP requests to webservice. There is no HTTP route from the gateway to secretservice, so by design a user on the internet is not supposed to talk to secretservice at all.
The eureka server, the registry itself, sits in the DMZ. A DMZ is a network zone that is partly exposed to the internet, often used for servers that must be reachable from outside. Here the registry was exposed by mistake. The user, or attacker, is on the internet.
How the registry learns about services
When a micro-service starts, it sends a REGISTER request to the Eureka server. Think of it as a shop putting its name and address into a directory. Later it sends a STATUS update every N seconds, 30 seconds by default, to say "I am still alive". From these messages the registry knows how many copies (instances) of each service are running and what their addresses are. An address can be a DNS name (a human-readable name like example.com) or an IP address (the numeric address behind it).
The registry is not a proxy. A proxy forwards traffic; the registry only stores information. It is passive storage. The thing that actually forwards traffic is the gateway, and it gets its information from the same registry. So the chain is: services register with Eureka, the gateway reads Eureka, and the gateway sends user requests to whichever address Eureka listed.
The one route the gateway has
In the lab the gateway handles only one route, to webservice:
.route("webservice", r -> r.path("/**") .uri("lb://WEBSERVICE"))
Line by line, in plain words:
.route("webservice", ...)starts the definition of a route namedwebservice.r -> r.path("/**")says: this route matches any path./**is a wildcard meaning "everything after the slash", so any URL path a user requests matches..uri("lb://WEBSERVICE")says where to send it.lbstands for load balancing: instead of one fixed address, the gateway asks the registry for all running instances of the service namedWEBSERVICEand spreads requests between them.
So every path that is not separately registered on the gateway is balanced to the micro-service named webservice. There is no route to secretservice, which is exactly the restriction the first attack will bypass. In the wild, the hidden service could be any internal micro-service that trusts all incoming requests, because a service like secretservice is usually meant only for internal service-to-service communication.
Webservice itself talks to secretservice internally: it asks the Eureka client to find the secretservice address and then sends a request there. The Eureka client is the library inside each service that talks to the registry; it keeps all the information collected from the Eureka server in memory and refreshes it once per N seconds, 30 seconds by default. After you change the registry, the gateway needs to sync the information before it balances to the new instance.
The setup, and a search engine
The lab consists of the two backend services, the gateway, the exposed Eureka server and an attacker on the internet. The researcher also checked how many Eureka servers can be found by Google, noting that the search query (a dork, a search string crafted to find a particular kind of page) could probably be improved:

Talking to the pentester community suggested that leaving the registry service outside is a common potential security misconfiguration. The lab layout is shown below:

The idea behind both attacks
The starting observation is that the registry can become a point of failure from a security point of view, and that it is not always properly secured. The main idea behind both attack vectors is changing HTTP routing with some profit for exploitation.
Having access to the registry, an attacker can register a fake service and try to reach it through Spring Cloud Gateway. Once the fake service is registered, the gateway begins to balance requests to it if the right service name was registered. Two consequences follow:
- If an attacker registers a new instance of an existing micro-service and maps it to an internal micro-service that has no public HTTP route, the attacker can send HTTP requests to that service. This is SSRF.
- If the attacker registers a malicious service outside, both the gateway and internal services will send requests to that fake service outside. This allows hijacking a victim's traffic, with XSS, or hijacking internal service connections.
Attack Vector 1: Server Side Request Forgery

SSRF means making a server send a request on your behalf. A simple comparison: you cannot enter a building, but the receptionist can. If you can convince the receptionist to walk to a locked room and read out what is inside, you have reached the room without entering it. Here the gateway is the receptionist, and secretservice is the locked room.
Successful exploitation needs a service mapped to the root URL /. The root URL is just the bare address with nothing after the slash, like the home page of a site. This is not strictly a requirement, but it gives more freedom in path walking, meaning you can append different paths after the root and have them forwarded. In the lab, Spring Cloud Gateway already maps / to webservice.
Step 1: find the target's address
First, find the address of the targeted micro-service (secretservice) on the registry:

Why this step: the registry lists every service and its address. You cannot point the gateway at secretservice unless you know where secretservice lives.
Step 2: register a fake instance of webservice
Register a new micro-service with the name webservice but with the address and port of secretservice. To do this, change the ipAddr, hostName and port parameters in the Eureka registration request:

Why this step: the gateway does not ask "is this really webservice?" It trusts the registry. If the registry says there is an instance of webservice at the address of secretservice, the gateway will send some of the traffic there. The three fields are the ones that describe where the instance is: ipAddr is the IP address, hostName is the host name, and port is the network port (the numbered door on a machine that a service listens on).
Step 3: let the gateway rebalance and send requests
There are now two instances of webservice. After the gateway syncs information from the registry, it begins to balance attacker requests between the two instances. Because one instance points to secretservice, the route restriction on the HTTP layer is bypassed and the SSRF succeeds. During multiple requests you will see two different pages: a 404 error, because there is no route for /flag on the legitimate webservice, and FLAG{EUREKA_PWNED}:


Why you see two pages: the gateway spreads requests across both instances. Some requests go to the real webservice, which has no /flag page, so you get a 404, the standard "not found" response. Other requests go to the fake instance, which is really secretservice, and there /flag returns the secret. Seeing both responses alternating is the proof that the trick worked.
Attack Vector 2: Traffic Hijack and XSS

In the second scenario, the attacker registers an instance of webservice pointing to a malicious server. The gateway then routes HTTP traffic to the attacker-controlled server. This leads to leakage of secrets such as a token or sessionId, and to XSS.
A token or sessionId is a short string a website gives your browser after you log in, so it can recognise you on later requests without asking for your password again. Think of it as a cloakroom ticket: whoever holds the ticket can collect the coat. If an attacker receives that string, they can often act as the logged-in user.
XSS (Cross-Site Scripting) means getting your own code, usually JavaScript, to run inside someone else's web page in a victim's browser. JavaScript is the programming language browsers run to make pages interactive. If an attacker's script runs on a page the victim trusts, it can read what the victim sees and does on that page.
For the browser, because communication with the malicious server happens in the backchannel, it looks like an official site, and TLS on the gateway does not help. The backchannel is the connection between the gateway and the backend, hidden from the browser. TLS is the encryption behind the padlock and https:// in your address bar. It protects the connection between your browser and the gateway, but it says nothing about where the gateway forwards your request afterwards. So the padlock can look perfectly fine while the request is being answered by the attacker.

The same trick can be applied to hijack internal service calls, leading to information leakage or more critical vulnerabilities. In other words, it is not only users' browsers that can be fooled: other backend services that look up webservice in the registry can be sent to the attacker too.
How to communicate with Eureka
The registration request itself is not reproduced in the write-up. The guidance is to update the fields app (both in the path and as a parameter), ipAddr and hostname. app is the application name, the service name the gateway matches on; it appears both in the URL path and as a parameter of the request, so both places need changing.
If that request does not work, for example because the protocol has changed since publication, the easiest way to extract the correct request is to run a simple Eureka client and server locally and capture the traffic with Wireshark, which should take around ten minutes. Wireshark is a program that records network traffic so you can read the exact requests and responses. Any tutorial about the registry works for this, for example the Spring service registration and discovery guide.
Root cause
The registry can be reached from the internet in this lab, and the gateway trusts the registry's contents to decide where to send traffic. Registering an instance of an existing service name with a different address is enough to redirect the gateway's load balancing. The route restriction that keeps users away from secretservice exists only at the HTTP layer of the gateway, so it is bypassed once the gateway itself is made to forward to the internal address. In the second vector, the same trust lets the gateway and internal services send requests to an attacker-controlled host, and because the browser only sees the official site, TLS on the gateway does not protect the backchannel.
Impact
With access to an exposed registry, an attacker can reach internal micro-services that have no public HTTP route, as demonstrated by reading the flag from secretservice. They can also receive traffic intended for a legitimate service, leaking secrets such as tokens or session identifiers and enabling XSS against users, and can hijack internal service-to-service calls, leading to information leakage or more critical vulnerabilities. In the wild the internal target can be any micro-service that trusts incoming requests, and the root-URL mapping is not strictly required but gives more freedom in path walking.
Fix
Keeping Eureka off the internet must not be the main defence, because exposure happens anyway. Security should be layered so that if one layer fails through a 0day (a previously unknown flaw with no fix yet) or a misconfiguration, the others still hold.
- Application layer: Eureka supports basic HTTP authentication; use it. Basic authentication is the simplest login scheme: a username and password sent with each request. It is not best practice and means sharing one password between multiple micro-services, but it buys time after an attacker finds an exposed registry.
- Presentation layer: mTLS between micro-services helps against registering a malicious service outside, and therefore against traffic hijack. mTLS means mutual TLS: both sides of a connection present a certificate, so each proves who it is, not just the server.
- Transport and network layers: micro-segmentation and strict firewall rules. Micro-segmentation means dividing the network into small zones so machines can only reach the few others they really need. There is no need for network connectivity between the gateway and secretservice, which protects against SSRF, and uncontrolled outbound connections to public networks should be prohibited, which protects against traffic hijacking and reverse shells (where an attacked machine opens a connection back to the attacker).
Variants to test
- Register an instance of an existing service name with
ipAddr,hostNameandportpointing at an internal host. A positive result is the gateway returning responses from the internal service, alternating with the legitimate instance's responses. - Register an instance pointing at a host you control and watch for incoming requests from the gateway or from internal services. A positive result is traffic, including tokens or session identifiers, arriving at your server.
- Look for a service mapped to
/on the gateway, which gives more freedom in path walking when targeting internal services. - If the registration request format is unknown or has changed, run a local Eureka client and server and capture the REGISTER request with Wireshark to reproduce the correct fields.
Glossary
- API: a defined way for one program to talk to another, usually over web requests.
- Application layer: the level of normal web requests and responses, as opposed to the network plumbing underneath.
- Backchannel: the connection between a front server and a backend service, invisible to the browser.
- Basic authentication: a simple login scheme where a username and password are sent with each request.
- DMZ: a network zone partly exposed to the internet, often holding servers that must be reachable from outside.
- DNS: the system that turns human-readable names into IP addresses.
- Dork: a search engine query crafted to find a particular kind of page.
- Eureka: Netflix's service registry, a RESTful service that micro-services use to find each other.
- Eureka client: the library inside a service that registers it with the registry and keeps a local copy of the registry's information.
- Flag: a secret string used in a lab or competition to prove an attack succeeded.
- Gateway: a front-door server that receives requests and forwards them to backend services.
- Host name: the human-readable name of a machine.
- Instance: one running copy of a service.
- IP address: the numeric address of a machine on a network.
- Load balancing: spreading requests across several copies of a service.
- Micro-service: a small program that does one job and talks to other small programs.
- Micro-segmentation: dividing a network into small zones with strict rules about who can reach whom.
- mTLS: mutual TLS, where both sides of a connection prove their identity with certificates.
- 0day: a previously unknown flaw for which no fix exists yet.
- Path walking: appending different paths to a base URL to reach different pages or endpoints.
- Port: the numbered door on a machine that a service listens on.
- Proxy: a server that forwards traffic between two parties.
- REGISTER request: the message a service sends to the registry to announce itself and its address.
- RESTful: spoken to over ordinary web requests to URLs.
- Reverse shell: a connection opened from an attacked machine back to the attacker, giving the attacker control.
- Root URL: the bare address of a site with nothing after the slash.
- Service registry: a directory where services announce their addresses so others can find them.
- SessionId: a string a site gives your browser to recognise you after login.
- SSRF: Server Side Request Forgery, making a server send a request on your behalf.
- STATUS update: the periodic message a service sends to say it is still alive.
- TLS: the encryption behind
https://and the padlock in the address bar. - Token: a short string that stands in for your identity or permission.
- Traffic hijack: redirecting traffic meant for a real service to an attacker-controlled one.
- Wireshark: a program that records network traffic so you can read the exact requests and responses.
- XSS: Cross-Site Scripting, getting your own code to run inside someone else's page in a victim's browser.