paramiko / paramiko/paramiko

[BUG] - <The EOF error of keyboard-interactive authentication>

Open
#2,341 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Python
Stars
9.9k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Are you using paramiko as a client or server?

Client

What feature(s) aren't working right?

SSH

What version(s) of paramiko are you using?

3.4.0

What version(s) of Python are you using?

python3.11.5

What operating system and version are you using?

WSL Debian GNU/Linux 12 (bookworm) on Windows 10

If you're connecting as a client, which SSH server are you connecting to?

JumpServer maybe OpenSSH

If you're using paramiko as part of another tool, which tool/version?

No response

Expected/desired behavior

show the interactive prompt:
Please Enter MFA Code.
(xxxx) [OTP Code]:

Actual behavior

DEBUG:paramiko.transport:starting thread (client mode): 0x1ed35b90
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_3.4.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-Go
INFO:paramiko.transport:Connected (version 2.0, client Go)
DEBUG:paramiko.transport:=== Key exchange possibilities ===
DEBUG:paramiko.transport:kex algos: curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group14-sha1
DEBUG:paramiko.transport:server key: ssh-rsa
DEBUG:paramiko.transport:client encrypt: aes128-gcm@openssh.com, chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr
DEBUG:paramiko.transport:server encrypt: aes128-gcm@openssh.com, chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr
DEBUG:paramiko.transport:client mac: hmac-sha2-256-etm@openssh.com, hmac-sha2-256, hmac-sha1, hmac-sha1-96
DEBUG:paramiko.transport:server mac: hmac-sha2-256-etm@openssh.com, hmac-sha2-256, hmac-sha1, hmac-sha1-96
DEBUG:paramiko.transport:client compress: none
DEBUG:paramiko.transport:server compress: none
DEBUG:paramiko.transport:client lang:
DEBUG:paramiko.transport:server lang:
DEBUG:paramiko.transport:kex follows: False
DEBUG:paramiko.transport:=== Key exchange agreements ===
DEBUG:paramiko.transport:Kex: curve25519-sha256@libssh.org
DEBUG:paramiko.transport:HostKey: ssh-rsa
DEBUG:paramiko.transport:Cipher: aes128-ctr
DEBUG:paramiko.transport:MAC: hmac-sha2-256
DEBUG:paramiko.transport:Compression: none
DEBUG:paramiko.transport:=== End of kex handshake ===
DEBUG:paramiko.transport:kex engine KexCurve25519 specified hash_algo
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Attempting public-key auth...
DEBUG:paramiko.transport:userauth is OK
DEBUG:paramiko.transport:Finalizing pubkey algorithm for key of type 'ssh-rsa'
DEBUG:paramiko.transport:Our pubkey algorithm list: ['ssh-rsa']
DEBUG:paramiko.transport:Server did not send a server-sig-algs list; defaulting to our first preferred algo ('ssh-rsa')
DEBUG:paramiko.transport:NOTE: you may use the 'disabled_algorithms' SSHClient/Transport init kwarg to disable that or other algorithms if your server does not support them!
INFO:paramiko.transport:Authentication continues...
DEBUG:paramiko.transport:Methods: ['keyboard-interactive']
DEBUG:paramiko.transport:EOF in transport thread
Traceback (most recent call last):
File "/home/shirann/project/python/g-bit/gskey-transporter/main.py", line 37, in
main()
File "/home/shirann/project/python/g-bit/gskey-transporter/main.py", line 33, in main
ssh.auth_interactive_dumb(JUMP_SERVER_USERNAME)
File "/home/shirann/miniconda3/envs/python3.11/lib/python3.11/site-packages/paramiko/transport.py", line 1750, in auth_interactive_dumb
return self.auth_interactive(username, handler, submethods)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/shirann/miniconda3/envs/python3.11/lib/python3.11/site-packages/paramiko/transport.py", line 1727, in auth_interactive
return self.auth_handler.wait_for_response(my_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/shirann/miniconda3/envs/python3.11/lib/python3.11/site-packages/paramiko/auth_handler.py", line 248, in wait_for_response
raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed: transport shut down or saw EOF

How to reproduce
def main():
    ssh = paramiko.Transport(
        (JUMP_SERVER_HOSTNAME, JUMP_SERVER_PORT),
        disabled_algorithms=dict(pubkeys=["rsa-sha2-512", "rsa-sha2-256"]),
    )
    pkey = paramiko.RSAKey(filename=JUMP_SERVER_PRIVATE_KEY_FILE)
    ssh.connect(username=JUMP_SERVER_USERNAME, pkey=pkey)
    ssh.auth_interactive_dumb(JUMP_SERVER_USERNAME)


if __name__ == "__main__":
    main()
Anything else?

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Transport.auth_interactive_dumb and auth_interactive, then follow AuthHandler.wait_for_response in transport.py and auth_handler.py. Reproduce the keyboard-interactive login against the described server and determine why the transport reaches EOF before presenting the MFA prompt; done means the prompt is shown and authentication can continue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.