Summary
Jpom's SSH batch-command endpoint can use command-template and SSH-node IDs without checking that those resources belong to the authenticated user's workspace. A user with SSH command execution permission in one workspace may therefore run commands on SSH hosts in other workspaces if they can provide the corresponding IDs.
Affected context
The issue occurs in the POST /node/ssh_command/batch endpoint when it resolves command templates and SSH nodes by ID without applying workspace-level authorization checks. It is risky in deployments where users have SSH command execution permission in one workspace and SSH resources or stored credentials exist in other workspaces.
Exploit preconditions
- Attack surface: The authenticated SSH batch-command endpoint
- Required access: An account with SSH command execution permission in at least one workspace
- Trigger point: Processing a batch request that references command-template and SSH-node IDs
- Why exploitation is possible: Resource lookup is based on IDs without confirming that the resources belong to the user's authorized workspace
Why this happens
The endpoint treats user-supplied resource identifiers as sufficient to locate command templates and SSH nodes, but does not consistently verify the caller's authority over those resources. This is an authorization bypass through a user-controlled key, mapping to CWE-639. Authorization should be checked against the resource and workspace, not inferred from possession of an ID or permission in a different workspace.
Potential impact
- Users may execute commands on SSH hosts outside their authorized workspace
- Stored SSH credentials may be used to access systems across workspace boundaries
- Commands could disrupt services, alter data, or expose information on affected hosts
- A compromised account may enable broader lateral movement, depending on host access and network controls
General mitigation guidance
Defensive patterns focus on enforcing authorization at every resource lookup and command-execution boundary.
- Scope template and node queries to the caller's authorized workspace
- Verify ownership and permission for each referenced resource before using stored credentials or executing commands
- Derive workspace scope from trusted server-side identity and authorization context rather than request-supplied IDs
- Apply least privilege to user roles, SSH accounts, and the systems reachable by the application
- Use secure-by-default resource APIs that require an authorization context for lookups and actions
How teams detect issues like this
- Review endpoint code and shared lookup helpers for ID-based resource access that omits workspace or ownership checks
- Use static analysis or code-review rules to flag sensitive operations driven by request-supplied identifiers without authorization checks
- Test authorization policies with resources belonging to different workspaces, including batch operations
- Monitor audit logs for command executions where the user's workspace and the target resource's workspace do not match
- Enforce centralized authorization policies for SSH execution and cross-workspace resource access

