AllowTcpForwarding is an OpenSSH server setting that controls whether TCP port forwarding is permitted for a user or connection. It governs local, remote, and dynamic forwarding, and is commonly used to limit tunnelling through SSH and reduce unintended access paths.
What AllowTcpForwarding Controls
AllowTcpForwarding is not an authentication control, but it is a powerful access-path control inside SSH. It determines whether an authenticated session can create port-forwarded tunnels, so it directly shapes how users, administrators, and automated connections can reach internal services through an SSH hop.
Why Port Forwarding Matters in SSH
SSH forwarding can be useful for maintenance, database access, jump-host workflows, and secure remote administration. The same feature can also become a hidden conduit into restricted network segments if it is left broadly enabled. When port forwarding is allowed, the SSH connection is doing more than providing a shell, it can also relay traffic to services that were never meant to be exposed through that route.
That is why the setting is often treated as part of segmentation and trust-boundary design. If an organisation assumes SSH access is limited to interactive commands, but forwarding remains available, the effective access granted by the session is larger than the team may realise.
Common Deployment Patterns and Policy Choices
Administrators commonly use AllowTcpForwarding to separate ordinary login access from tunnelling capability. Some environments permit forwarding only for tightly controlled operators, some allow it only on specific bastion hosts, and some disable it entirely where SSH should remain a narrow management channel.
The practical question is not whether forwarding exists in OpenSSH, but whether the business use case justifies it on each host, account, or connection class. For example, an admin jump box may need it, while a production server used for routine access may not. Aligning that choice with host role, user role, and network exposure is what keeps SSH from becoming an unplanned relay service.
Operational Consequences of Misconfiguration
Misconfigured forwarding can create unexpected lateral movement opportunities, bypass network controls, or complicate incident investigations because traffic appears to originate from a trusted SSH session. It can also widen the impact of stolen SSH credentials, since an attacker who gets a valid login may gain a pathway into otherwise unreachable internal endpoints.
In practice, the risk is often less about the setting alone and more about what it combines with: broad SSH access, weak key hygiene, over-permissive accounts, or exposed bastion hosts. A single allowed tunnel can defeat the intent of firewall rules, service isolation, or admin-only network paths if those assumptions are not tested together.
How to Use It Safely
Secure use starts with the simplest possible policy: allow forwarding only where there is a documented operational need, then narrow it by account, host group, and surrounding SSH restrictions. Organisations should treat forwarding as a deliberate exception, not a default convenience feature.
Where forwarding is necessary, pair it with monitoring of SSH configuration drift, review of who can establish tunnels, and periodic validation that the resulting access paths still match the intended network design. That keeps the setting aligned with real administrative workflows instead of silently expanding them.
Risk and Threat Considerations
AllowTcpForwarding can become an abuse path when SSH access is compromised or when forwarding is enabled more broadly than intended. The concern is not just tunnelling itself, but the way it can hide internal reachability behind a trusted remote session and make segmentation controls easier to bypass.
Failure mechanism: An attacker with valid SSH access, or a legitimate user with excessive privilege, can open a tunnel to internal services and pivot through the SSH endpoint as if it were a sanctioned relay.
Impact: This can enable hidden access to sensitive systems, make lateral movement easier, and reduce the visibility of malicious traffic that is moving inside an otherwise trusted management channel.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-53 Rev 5, CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | AC-4 — Information Flow Enforcement | Port forwarding changes what network flows an SSH session can carry. |
| AC-17 — Remote Access | AllowTcpForwarding is an SSH remote-access behaviour that expands session capabilities. | |
| SC-7 — Boundary Protection | SSH forwarding can bypass intended internal boundary controls and segmentation. | |
| Recommendation — Restrict SSH forwarding paths to approved destinations and network zones. Limit remote-access features to the minimum functions each role needs. Validate that SSH tunnels do not undermine boundary protections or segmentation. | ||
| CIS Controls v8 | CIS-12 — Network Infrastructure Management | SSH forwarding policy is part of managing secure administrative network paths. |
| Recommendation — Harden SSH administrative paths and remove unnecessary tunnelling capability. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions are Managed | Forwarding permission is an access capability that should be granted deliberately. |
| Recommendation — Assign SSH forwarding permission only to users and hosts with a documented need. | ||
Practitioner Guidance
Why practitioners should care: Treat AllowTcpForwarding as a policy decision about reachability, not a minor convenience flag. If forwarding is permitted, the session may carry far more access than a shell-only review suggests.
What to watch for: Review where the setting is enabled, who can use it, and whether the permitted tunnels still reflect the current network boundary. Unexpected forwarding permission on shared hosts or bastions is often the clearest sign that the control needs tightening.
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 3, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org