Skip to content

sandbox-escape-ssh-self misses an ssh-to-self call inside a double-quoted command substitution #36904

Closed

Description

@buluoray

Existing issues

  • I searched open issues and this is not already reported.

KiroCrew version

main at 9b39b80 (source checkout, not a release build)

Release channel

Not sure

How is it installed?

From source

Platform

Not platform-specific

What happened

The ssh-to-self guard (sandbox-escape-ssh-self) lets an ssh-to-this-host call through when it sits in a command substitution inside double quotes. Bash runs a $(...) inside double quotes, so the ssh runs.

from kiro_crew.security.deny_gate import is_denied
is_denied("echo $(ssh -p 22 localhost id)")       # refused
is_denied('echo "`ssh -p 22 localhost id`"')      # refused
is_denied('echo "$(ssh -p 22 localhost id)"')     # allowed
is_denied('x="$(ssh -p 22 localhost id)"')        # allowed

The -p 22 keeps the rule's catalog pattern from matching, so only the argv floor judges these lines. The floor refuses the unquoted $(...) and the double-quoted backtick, and misses the double-quoted $(...).

Steps to reproduce

  1. On main, call kiro_crew.security.deny_gate.is_denied with both lines above.
  2. The first is refused with rule=sandbox-escape-ssh-self component=argv-floor.
  3. The second is allowed, although bash runs the same ssh.

Anything else

Expected: a $(...) or backtick substitution inside double quotes is read as a command, the same as an unquoted one, so the second line is refused too. A substitution inside single quotes stays plain text (#36887).

Found while working on #36887; the gap is on main before that change and after it.

Activity

  1. CrysisDeu commented on Nov 14, 2026

    @CrysisDeu
    Contributor

    Tracking only: buluoray's open PR #36903 lists this issue in its closing references and may close it. No separate fix from our side.

  2. buluoray commented on Nov 15, 2026

    @buluoray
    ContributorAuthor

    Still allowed on main 3397952, on #37037's head and on #34056's head (fb6373c): echo "$(ssh -p 22 <self> id)" and x="$(ssh -p 22 <self> id)". A fix PR for this issue is being prepared now.

  3. added 4 commits that reference this issue on Nov 15, 2026
    74f9ad0
    f40fa99
    0b5b0e4
    f843b45
  4. added a commit that references this issue on Nov 15, 2026
    87b11b5
  5. added a commit that references this issue on Nov 16, 2026
    d9ab644
  6. added a commit that references this issue on Nov 16, 2026
    2837764
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions