Undecimus: Unable to change port in the version of OpenSSH shipped with unc0ver

Created on 8 Feb 2019  Ā·  13Comments  Ā·  Source: pwn20wndstuff/Undecimus

The default port of SSH is 22 and I want to switch to a higher port number for security purposes (working on open Wi-Fi, so) and also to be able to allow SSH into my device locally. I also want my SFTP server to be on that exact same higher port.

So here’s the issue. On other jailbreaks I used to be able to edit /etc/ssh/sshd_config and remove the hashtag before ā€œPortā€ to allow customizing port number like I did with my linux machines. On unc0ver, however, the file sshd_config under the same directory appears to have faulty permissions which seems to me that sshd will not read its configuration because of this. I know this because upon modifying sshd_config to allow public key authentication and disable password login, it didn’t work until I changed the mask to 755.

However, changing the port number doesn’t work as expected AFTER a rejailbreak/reboot. So after I removed the hashtag and started a new sshd daemon by calling /usr/sbin/sshd, yes, I can ssh into the device at the port number specified. The issue becomes, if I reboot and then jailbreak, sshd will be running on port 22 again instead of the port specified in /etc/ssh/sshd_config. (The whole file doesn’t seem to have been read by the daemon) Very weird issue indeed. When troubleshooting with /usr/sbin/sshd -d I don’t see a problem coming out of the console except that it’s running on port 22 instead of the one I specified.

Worth to mention that I did try other working OpenSSH packages to troubleshoot. They include that really old version from 2016 on saurik’s repo, the relatively newer one on CS’s repo, but both didn’t survive a reboot due to the fact that unc0ver seems to have automatically replaced its supposedly latest version with unusable sshd_config back after each reboot even if I have ā€œReinstall OpenSSHā€ toggled off in its Settings.

Anyone has some insights on this or might want to share how one can change its port number on unc0ver?

There’s probably something wrong with the OpenSSH bundled with unc0ver since I’ve reinstalled it through Cydia (sbinger’s repo) and unc0ver multiples times and even if I start fresh the sshd_config is still not functioning.

Also since I’m posting this I also got the problem of all fakesigned apps crashing on unc0ver even if used the same ipas to reinstall them. I already have AppSync Unified installed from Karen’s repo but still. They used to work fine on Electra so I’m not quite sure what’s causing this. On the pro side I did experience the exploit process being much much smoother with voucher_swap on the 3.0 version. Huge thanks to the developers!

Most helpful comment

I don’t see how to do it. I tried adding <string>-p</string><string>2222</string> under ProgramArguments but that didn’t do it.

Edit: I found you have to change the SockServiceName from ssh to 2222 in the LaunchDaemon plist. Adding args -p 2222 or changing the port in /etc/ssh/sshd_config will not do anything. However, you can still disable password based authentication using /etc/ssh/sshd_config.

Thought I'd leave this here in case anyone else ever comes across this.

All 13 comments

This is not a bug. You should modify the launch daemon plist instead.

@JQ555888 ^

This is not a bug. You should modify the launch daemon plist instead.

Ah I see now. Thank you!

EDIT: Yes. Confirm it works. Indeed it’s /Library/LaunchDaemons/com.openssh.ssh.plist that I should have been looking into.

I don’t see how to do it. I tried adding <string>-p</string><string>2222</string> under ProgramArguments but that didn’t do it.

Edit: I found you have to change the SockServiceName from ssh to 2222 in the LaunchDaemon plist. Adding args -p 2222 or changing the port in /etc/ssh/sshd_config will not do anything. However, you can still disable password based authentication using /etc/ssh/sshd_config.

Thought I'd leave this here in case anyone else ever comes across this.

I don’t see how to do it. I tried adding -p2222 under ProgramArguments but that didn’t do it.

Edit: I found you have to change the SockServiceName from ssh to 2222 in the LaunchDaemon plist. Adding args -p 2222 or changing the port in /etc/ssh/sshd_config will not do anything. However, you can still disable password based authentication using /etc/ssh/sshd_config.

Thought I'd leave this here in case anyone else ever comes across this.

Thanks a million!! I’ve been desperate for this exact fix. I had been trying to modify the plist to -f /etc/ssh/sshd_config which didn’t work either.

Unc0ver should by default SSH on either port 2222, or 22 and 2222, because iOS deliberately blocks any app from connecting to localhost:22. Currently, you literally need 2 devices just to get to a terminal on the device you’re using.

EDIT 2020/04/17:
@pwn20wndstuff you should really reconsider this. Why have a jailbreak default to an SSH port you can’t use on the device!? You needlessly require 2 devices. The ideal solution would be a config for both 22 and 2222, I don’t know if that’s possible.

But the /Library/LaunchDaemons/com.openssh.ssh.plist SockServiceName ā€œsshā€ āž”ļø ā€œ2222ā€ definitely works to move it to 2222. Otherwise it’s needlessly very confusing and frustrating for new jailbreakers wondering why they can’t SSH to their own device or 127.0.0.1.

I don’t see how to do it. I tried adding -p2222 under ProgramArguments but that didn’t do it.

Edit: I found you have to change the SockServiceName from ssh to 2222 in the LaunchDaemon plist. Adding args -p 2222 or changing the port in /etc/ssh/sshd_config will not do anything. However, you can still disable password based authentication using /etc/ssh/sshd_config.

Thought I'd leave this here in case anyone else ever comes across this.

OMG thanks, now it works...

@Siggi88
Thank you so much. This is still relevant and working on unc0ver for 13.5

def worth putting this info in a more prominent place. Glad I was able to "unc0ver" this crucial information!

Thanks so much @Siggi88 what a legend!

Many thanks for this. I'd had a look at the plist but didn't quite get that the "ssh" for the socket was defining the port number. Great info!

Can someone help me? I installed OpenSSH and Filza. But when I enter the

/Library/LaunchDaemons/com.openssh.ssh.plist SockServiceName ā€œsshā€ āž”ļø ā€œ2222ā€ definitely works to move it to 2222.

I cant get it to change to 2222, when i delete ssh and make it 2222 and click on save FilzaEscaped crashes. What can I do? It seems like I dont have the right permission to edit the file.

What is FilzaEscaped and why are you using that instead of the real Filza?
I suspect this is your problem.

في سبت، ٔل أغسطس، ٢٠٢٠ في ٔ:ل٨ ص، كتب badger200 notifications@github.com:

What is FilzaEscaped and why are you using that instead of the real Filza?
I suspect this is your problem.

On Thu, Aug 13, 2020 at 10:44 AM Vsteegman notifications@github.com
wrote:

Can someone help me? I installed OpenSSH and Filza. But when I enter the

/Library/LaunchDaemons/com.openssh.ssh.plist SockServiceName ā€œsshā€ āž”ļø
ā€œ2222ā€ definitely works to move it to 2222.

I cant get it to change to 2222, when i delete ssh and make it 2222 and
click on save FilzaEscaped crashes. What can I do?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<
https://github.com/pwn20wndstuff/Undecimus/issues/335#issuecomment-673554343
,
or unsubscribe
<
https://github.com/notifications/unsubscribe-auth/ABNV24MHS22JFNMUUUUJBJLSAQC6BANCNFSM4GWA2PVQ

.

>

Sent from Gmail Mobile

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/pwn20wndstuff/Undecimus/issues/335#issuecomment-674303547,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AN7M56HB4Z3GQAQ5OTC4G6DSAW6RJANCNFSM4GWA2PVQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brianvis picture brianvis  Ā·  3Comments

NAVECCIER picture NAVECCIER  Ā·  3Comments

ccdffddfddfdsfedeee picture ccdffddfddfdsfedeee  Ā·  3Comments

miguelr4720 picture miguelr4720  Ā·  3Comments

gbm777 picture gbm777  Ā·  3Comments