From c58056b01a2d312c56ddc6f404d963c2017aa536 Mon Sep 17 00:00:00 2001 From: lelonek1 Date: Sat, 21 Jan 2017 01:30:31 -0500 Subject: [PATCH] Refuse to enable SGA and LINEMODE during authentication (#415) Some telnet clients attempt to initiate negotiation about SGA and LINEMODE themselves, but only when a port isn't specified on the command line. If we allow them to enable SGA or LINEMODE, they change from sending a newline character when enter is pressed to sending a carriage return. Cowrie can't handle this properly at the login prompt, which prevents the client from being able to login. I left the old code commented out so it is easier re-enable once Cowrie/Twisted support the Telnet protocol better. Fixes #414 --- cowrie/telnet/transport.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cowrie/telnet/transport.py b/cowrie/telnet/transport.py index a2f0a96..bb92f26 100644 --- a/cowrie/telnet/transport.py +++ b/cowrie/telnet/transport.py @@ -180,15 +180,17 @@ class HoneyPotTelnetAuthProtocol(AuthenticatingTelnetProtocol): if opt == ECHO: return True elif opt == SGA: - return True + return False + #return True else: return False def enableRemote(self, opt): if opt == LINEMODE: - self.transport.requestNegotiation(LINEMODE, MODE + chr(TRAPSIG)) - return True + return False + #self.transport.requestNegotiation(LINEMODE, MODE + chr(TRAPSIG)) + #return True elif opt == NAWS: return True elif opt == SGA: