SSHRD_Script icon indicating copy to clipboard operation
SSHRD_Script copied to clipboard

Can't SCP/SFTP because of bad libresolv.9.dylib

Open retagaine opened this issue 6 months ago • 2 comments

I have an iPhone 6s+ that's stuck in recovery mode, likely because I tried an update and the storage was close to full (this was many years ago, so I don't remember exactly).

I'm able to create the SSH ramdisk with iOS 12.0 and even run mount_filesystems up until seputil --gigalocker-init, where it says that --gigalocker-init isn't a valid flag. I tried again and didn't run the mount_filesystems script and instead decided to mount all the disks manually, but ls -laht /mntX was empty so it doesn't look like things are mounting successfully.

I want to copy /dev/disk* off my phone and onto my Mac and take a peek, but I can't SCP/SFTP out, getting the error:

dyld: Library not loaded: /usr/lib/libresolv.9.dylib
  Referenced from: /usr/libexec/sftp-server
  Reason: no suitable image found.  Did find:
	/usr/lib/libresolv.9.dylib: missing LC_DYLD_INFO load command
	/usr/lib/libresolv.9.dylib: missing LC_DYLD_INFO load command
	/usr/lib/libresolv.9.dylib: missing LC_DYLD_INFO load command
	/usr/lib/libresolv.9.dylib: missing LC_DYLD_INFO load command

mast3rz3ro writes linking to a separate libresolv.9.dylib. That link doesn't go anywhere, but this folder does have a ssh.tar.xz file, out of which I take the libresolv.9.dylib out of and copy into the contents of ssh.tar.gz in this repository and rezip.

When I reboot, I'm able to see the green SSHRD face, but the ASCII SSHRD face that I usually see doesn't appear and it looks like something crashes, because I'm led to a screen with an Apple logo and a gray loading bar.

I tried a few different options, such as copying the libresolv.9.dylib into separate filepaths (/usr/lib, /usr/bin) hoping that I can just copy it into the right place once I'm SSHed in. I noticed some warning/error about headers, which I think was because I was using the tar util that comes with Mac OS. I installed gnu-tar off brew and that error seems to have gone away.

The error seems to be pretty consistent, because if I use the "untouched" ssh.tar.gz that comes from this repository, I'm able to boot and SSH in just fine.

retagaine avatar Jan 21 '24 04:01 retagaine

I was able to copy /dev/disk* off of my phone by following a similar method as the dump-blobs command and cating the files out via sshpass and piping it into dd locally -- something like sshpass -p 'alpine' ssh -o StrictHostKeyChecking=no -p2222 root@localhost "cat /dev/disk*" | dd of=disk.raw. From there I'm actually able to put the disk files into some kind of file recovery tool like DMDE or Disk Drill.

But, I'm still not able to mount_filesystems unfortunately.

retagaine avatar Jan 27 '24 04:01 retagaine

but this folder does have a ssh.tar.xz file, out of which I take the libresolv.9.dylib out of and copy into the contents of ssh.tar.gz in this repository and rezip.

The ssh package in sshrd lite are the same one as the sshrd the only differents is that it's contains different libresolv.9.dylib and this one should solve the scp issue in iOS 12.x

When I reboot, I'm able to see the green SSHRD face, but the ASCII SSHRD face that I usually see doesn't appear and it looks like something crashes, because I'm led to a screen with an Apple logo and a gray loading bar.

What you mean ? Some times the device could be lagged with last bootlogo while rebooting it this should be a normal behavior and won't case any problems.

I tried a few different options, such as copying the libresolv.9.dylib into separate filepaths (/usr/lib, /usr/bin) hoping that I can just copy it into the right place once I'm SSHed in

This is won't work since the dylib are getting loaded after booting the device, instead you can repack the ssh package or you can just use the one provided in sshrd lite.

But, I'm still not able to mount_filesystems unfortunately.

Have you tried using meowcat454's mount script ? Also do you know which iOS is in the device ?

mast3rz3ro avatar Feb 04 '24 19:02 mast3rz3ro