Skip to content

Instantly share code, notes, and snippets.

@tjunussov
Created April 23, 2020 07:52
Show Gist options
  • Select an option

  • Save tjunussov/5b903497c5ee89a2de03dd9d1c37b350 to your computer and use it in GitHub Desktop.

Select an option

Save tjunussov/5b903497c5ee89a2de03dd9d1c37b350 to your computer and use it in GitHub Desktop.
SMB Proxy on Windows via SSH Tunner

launch hdwwiz.exe network adapters -> Microsoft KM-TEST Loopback Adapter -> finish

!Important disable everything except ipv4 in that new network sink inside the ipv4 settings set up a ip, 255.255.255.255 as subnet mask and disable netbios

if you cannot decide on an ip simply use 192.168.2.123. sadly it's impossible to use 127.0.0.2 or similar for this. windows for some unknown reason will not connect to it. elevated windows shell

run sc config lanmanserver start= delayed-auto this is sadly required since microsoft will bind it's smb bullshit to 0.0.0.0:445 thus making it impossible to listen to that port yourself. microsoft also does not want you to use smb on a port different than 445. run netsh interface portproxy add v4tov4 listenaddress=192.168.2.123 listenport=445 connectaddress=192.168.2.123 connectport=44445 this will ensure that 445 stays bound as soon as lanmanserver starts. thus making it possible for you to just spawn a listener onto 44445 to listen to 445 without eaddrinuse errors etc. edit %windir%\system32\drivers\etc\hosts and add an appropriate mapping like: 192.168.2.123 smbproxy reboot just use ssh -L 192.168.2.123:44445:internalsmbhost:445 sshuser@publicjumphost open explorer and navigate to \smbproxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment