View Issue Details

IDProjectCategoryView StatusLast Update
0008159Kali LinuxKali Package Bugpublic2023-08-25 16:20
Reporterth3fr0x3n Assigned To 
PriorityhighSeverityblockReproducibilityalways
Status closedResolutionopen 
Product Version2022.4 
Summary0008159: WSL kex and SSH errors
Description

Kali running in WSL failing to run kali in windows mode. ESM and SL will open.

Linking other issue https://bugs.kali.org/view.php?id=7586

as it seems very simular

creating new issue because I have the same error but also issues with running ssh.

SSH will not start for IPv4 was running systemd at one point and got the error report that ssh failed to bind to port 22 on 0.0.0.0 because the address was already in use.

Steps To Reproduce

kex --win

sudo service ssh start

Attached Files

Activities

th3fr0x3n

th3fr0x3n

2023-01-26 20:06

reporter   ~0017429

Okay, confession time.
I resolved half my problem.

SSH:
In order to access my kali image via SSH from other devices in my house I needed a way to get to the SSH server through my windows host machine. I accomplished this with a powershell script that I had gotten off the internet.

The script runs netsh portproxy commands that forward ports like 22 from the outside into the kali vm.

I set this script to run at startup and didn't have any issues starting services on the kali machine.

what changed?

I am not to sure but now if the port proxy is running for 22 the kali machine detects this as the port being used and fails to start up the service for the port.

Solution:

run the script after the ssh service is running and it works just fine.

However:

This still hasn't resolved the Kex issues so I am not sure if we should close this issue but seeing how the ssh problem was the only thing that made this issue unique from https://bugs.kali.org/view.php?id=7586 then I understand if the reasoning for resolving it.

NIC-BRIDGE.ps1 (1,255 bytes)   
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';

if( $found ){
  $remoteport = $matches[0];
} else{
  echo "The Script Exited, the ip address of WSL 2 cannot be found";
  exit;
}

#[Ports]

#All the ports you want to forward separated by coma
$ports=@(22,80,443,5901,10000,3000,5000);


#[Static ip]
#You can change the addr to your ip config to listen to a specific address
$addr = '0.0.0.0' ;
$ports_a = $ports -join ",";


#Remove Firewall Exception Rules
iex "Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' ";

#adding Exception Rules for inbound and outbound Rules
iex "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Outbound -LocalPort $ports_a -Action Allow -Protocol TCP";
iex "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Inbound -LocalPort $ports_a -Action Allow -Protocol TCP";

for( $i = 0; $i -lt $ports.length; $i++ ){
  $port = $ports[$i];
  iex "netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$addr";
  iex "netsh interface portproxy add v4tov4 listenport=$port listenaddress=$addr connectport=$port connectaddress=$remoteport";
}
Write-Output $addr
NIC-BRIDGE.ps1 (1,255 bytes)   
g0tmi1k

g0tmi1k

2023-08-25 16:20

administrator   ~0018398

This report has been filed against an old version of Kali. We will be closing this ticket due to inactivity.

Please could you see if you are able to replicate this issue with the latest version of Kali Linux (https://www.kali.org/get-kali/)?

If you are still facing the same problem, feel free to re-open the ticket. If you choose to do this, could you provide more information to the issue you are facing, and also give information about your setup?
For more information, please read: https://www.kali.org/docs/community/submitting-issues-kali-bug-tracker/

Issue History

Date Modified Username Field Change
2023-01-24 22:28 th3fr0x3n New Issue
2023-01-26 20:06 th3fr0x3n File Added: NIC-BRIDGE.ps1
2023-01-26 20:06 th3fr0x3n Note Added: 0017429
2023-08-25 16:20 g0tmi1k Note Added: 0018398
2023-08-25 16:20 g0tmi1k Status new => closed