Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy issue when i try connect to SSH #1733

Open
r1beirin opened this issue Jun 24, 2022 · 2 comments
Open

Proxy issue when i try connect to SSH #1733

r1beirin opened this issue Jun 24, 2022 · 2 comments

Comments

@r1beirin
Copy link

r1beirin commented Jun 24, 2022

Describe the bug
My proxy it's with simple backend in a Google Cloud. When i try to connect to my port 22 (it's another real port) return a message error in my console
"Connection to IPADDRESS closed by remote host.
Connection to IPADDRESS closed."

When open the log we see this one more time:

2022-06-24T12:05:34.602908Z [cowrie.ssh.factory.CowrieSSHFactory] New connection: 10.128.0.8:48744 (10.128.0.8:22) [session: e2caba420ec2]
2022-06-24T12:05:34.603477Z [cowrie.ssh_proxy.client_transport.BackendSSHFactory#info] Starting factory <cowrie.ssh_proxy.client_transport.BackendSSHFactory object at 0x7f9f9d8d82b0>
2022-06-24T12:05:34.603718Z [FrontendSSHTransport,2161,10.128.0.8] Remote SSH version: SSH-2.0-Twisted_22.4.0
2022-06-24T12:05:34.604190Z [FrontendSSHTransport,2161,10.128.0.8] SSH client hassh fingerprint: c5b446a031a5103b21dec543ea670076
2022-06-24T12:05:34.605019Z [cowrie.ssh_proxy.server_transport.FrontendSSHTransport#debug] kex alg=b'curve25519-sha256' key alg=b'ecdsa-sha2-nistp256'
2022-06-24T12:05:34.605088Z [cowrie.ssh_proxy.server_transport.FrontendSSHTransport#debug] outgoing: b'aes256-ctr' b'hmac-sha2-512' b'none'
2022-06-24T12:05:34.605146Z [cowrie.ssh_proxy.server_transport.FrontendSSHTransport#debug] incoming: b'aes256-ctr' b'hmac-sha2-512' b'none'
2022-06-24T12:05:34.605456Z [cowrie.ssh_proxy.client_transport.BackendSSHTransport#debug] kex alg=b'curve25519-sha256' key alg=b'ecdsa-sha2-nistp256'
2022-06-24T12:05:34.605541Z [cowrie.ssh_proxy.client_transport.BackendSSHTransport#debug] outgoing: b'aes256-ctr' b'hmac-sha2-512' b'none'
2022-06-24T12:05:34.605715Z [cowrie.ssh_proxy.client_transport.BackendSSHTransport#debug] incoming: b'aes256-ctr' b'hmac-sha2-512' b'none'
2022-06-24T12:05:34.609856Z [cowrie.ssh_proxy.client_transport.BackendSSHTransport#debug] NEW KEYS
2022-06-24T12:05:34.610052Z [BackendSSHTransport,client] Backend Connection Secured
2022-06-24T12:05:34.610180Z [cowrie.ssh_proxy.server_transport.FrontendSSHTransport#debug] NEW KEYS
2022-06-24T12:05:34.610396Z [BackendSSHTransport,client] Connection to client not ready, buffering packet from backend
2022-06-24T12:05:34.610666Z [Uninitialized] Connected to SSH backend at 10.128.0.8
2022-06-24T12:05:34.610817Z [Uninitialized] Connected to honeypot backend
2022-06-24T12:05:34.775116Z [-] Connection to honeypot backend refused: Couldn't bind: 24: Too many open files.. Disconnecting frontend...
2022-06-24T12:05:34.777213Z [FrontendSSHTransport,2183,10.128.0.8] Unhandled Error
        Traceback (most recent call last):
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/application/app.py", line 304, in runReactorWithLogging
            reactor.run()
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/internet/base.py", line 1315, in run
            self.mainLoop()
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/internet/base.py", line 1328, in mainLoop
            reactorBaseSelf.doIteration(t)
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/internet/epollreactor.py", line 244, in doPoll
            log.callWithLogger(selectable, _drdw, selectable, fd, event)
        --- <exception caught here> ---
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/python/log.py", line 96, in callWithLogger
            return callWithContext({"system": lp}, func, *args, **kw)
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/python/log.py", line 80, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/python/context.py", line 117, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/python/context.py", line 82, in callWithContext
            return func(*args, **kw)
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/internet/posixbase.py", line 696, in _doReadOrWrite
            self._disconnectSelectable(selectable, why, inRead)
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/internet/posixbase.py", line 300, in _disconnectSelectable
            selectable.connectionLost(f)
          File "/home/cowrie/cowrie/cowrie-env/lib/python3.9/site-packages/twisted/internet/tcp.py", line 326, in connectionLost
            protocol.connectionLost(reason)
          File "/home/cowrie/cowrie/src/cowrie/ssh_proxy/server_transport.py", line 367, in connectionLost
            if self.sshParse.client and self.sshParse.client.transport:
        builtins.AttributeError: 'SSH' object has no attribute 'client'

Then we see a lot of connection lost in log

`2022-06-24T12:05:34.805140Z [cowrie.ssh_proxy.server_transport.FrontendSSHTransport#info] connection lost
2022-06-24T12:05:34.805203Z [FrontendSSHTransport,2174,10.128.0.8] Connection lost after 0 seconds
2022-06-24T12:05:34.805689Z [BackendSSHTransport,client] Lost connection with the proxy's backend: None:None
2022-06-24T12:05:34.805838Z [cowrie.ssh_proxy.client_transport.BackendSSHFactory#info] Stopping factory <cowrie.ssh_proxy.client_transport.BackendSSHFactory object at 0x7f9f9d892610>

Anyone have idea how fix it?

@yhfwww
Copy link

yhfwww commented Sep 8, 2022

I have the same problem

@MandiYang
Copy link

MandiYang commented Mar 4, 2023

Seems related but not sure
#1766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants