Lateral Movement and Pivoting

Published
Length
3 min read

Luis Felipe Dias

All posts

You stop lateral movement and pivoting by isolating network zones and restricting role permissions. Teams also rotate keys and audit active sessions to block attackers from hopping between hosts. Most teams start by setting up firewalls, private subnets, and role rules. When roles or network rules are too broad, one stolen key opens many servers. An attacker or a careless script can then jump from one app to a database. How lateral movement and pivoting work across networks Attackers use late

Movement: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You stop lateral movement and pivoting by isolating network zones and restricting role permissions. Teams also rotate keys and audit active sessions to block attackers from hopping between hosts. Most teams start by setting up firewalls, private subnets, and role rules. When roles or network rules are too broad, one stolen key opens many servers. An attacker or a careless script can then jump from one app to a database.

How lateral movement and pivoting work across networks

Attackers use lateral movement and pivoting to move from one compromised machine to other systems. Pivoting means using that first compromised host as a relay to reach private networks. Lateral movement means expanding control across peers, databases, and internal services using stolen keys.

In a standard cloud setup, teams divide networks into public and private zones. Web apps sit in public zones, while databases stay in private zones. Engineers and apps use identity roles and network rules to talk across these zones. A role tells the system which user or service can log in to a host. Network rules define which ports and addresses can send traffic between two subnets.

When an engineer logs in to fix a server, they often store keys on disk. Background jobs and scripts also keep database keys in local memory or files. If an attacker gets on that server, they read those local keys and roles. They then use the host network path to pivot into the private database subnet. Because the server already has network permission, the firewall lets the new traffic pass.

How native rules limit host hopping

Cloud providers and operating systems give you native tools to limit this movement. You can set up security groups that only allow traffic from specific host addresses. You can also assign tight identity roles so each app only reads its own database. Teams split large networks into small segments so hosts cannot talk to each other. They also remove local admin rights and require multi-factor checks when engineers log in.

These native steps shrink the path an attacker can take after an initial breach. A compromised web server cannot reach a payroll database if the network blocks that route. Scoped roles also stop a dev server from reading production buckets in the cloud.

Movement: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Where native network and role rules fall short

Native network and role setups only check who logs in and where traffic starts. Once a user or app passes that first check, the keeps the session active. The database or server trusts every command sent over that approved path.

For production databases and hosts, someone still needs a valid role to run work. If an attacker steals an active session or compromises an approved host, native rules fail. The firewall sees valid traffic coming from an allowed IP address and port. The database sees a valid role and runs every query without checking the intent.

Native rules cannot inspect individual SQL statements or shell commands while they run in flight. They cannot stop an approved user from dumping a full table of customer emails. They also cannot mask phone numbers, card numbers, or national IDs in query results. To close this gap, teams need controls that inspect and filter every command in flight.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

What is the difference between lateral movement and pivoting?

Pivoting routes traffic through one compromised host to reach a hidden network zone. Lateral movement is the broader act of logging in to other hosts using stolen keys.

Why do firewalls fail to stop internal pivoting?

Firewalls check network addresses and ports, not the commands inside an allowed session. If a compromised server has permission to talk to a database, the firewall allows it.

How does data masking reduce risk after a pivot?

Data masking rewrites matched fields like emails and card numbers in query results. Even if someone reaches a database, the query output hides sensitive customer values.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.