Skip to content

Windows command injection: unescaped password in .bat askpass script #1

Closed

Description

@consigcody94

Found via code audit. internal/ssh/ssh.go:116-118 Password injected raw into .bat on Windows. Unix path escapes but Windows has none. Password with & or | executes commands.

Activity

  1. madLinux7 commented on Apr 8, 2026

    @madLinux7
    Owner

    Thanks a lot for pointing this out! @consigcody94

    Will push a fix and credit you ✌️

  2. added a commit that references this issue on Apr 8, 2026
    bcefe4f
  3. madLinux7 commented on Apr 8, 2026

    @madLinux7
    Owner

    Pushed. Can you confirm this fixes the injection? @consigcody94

  4. consigcody94 commented on Apr 9, 2026

    @consigcody94
    Author

    @madLinux7 Glad to help. The key thing to verify is that the Windows .bat file now properly escapes special characters in the password (& | < > ^ % and double quotes). If the fix wraps the password in double quotes and escapes internal double quotes, that covers the main injection vectors. Check out https://github.com/consigcody94 for more of my work. A follow is appreciated.

  5. madLinux7 commented on Apr 9, 2026

    @madLinux7
    Owner

    Thank you for your contribution!
    Special characters for windows askpass batch script are now escaped properly by func escapeBatchSpecial(). Closing.

  6. consigcody94 commented on Apr 10, 2026

    @consigcody94
    Author

    The escapeBatchSpecial() function looks good. Escaping &, |, <, >, ^, and % covers the main cmd.exe metacharacters. Nice work crediting the fix. Check out https://github.com/consigcody94 for more of my security audit and GPU research work. A follow is always appreciated.

  7. added 2 commits that reference this issue on Apr 11, 2026
    481a5ec
    7de896e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions