-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tcp-tunnel can’t bind a connection #22
Comments
Only works on MacOSX as the host because the networking system calls are different on Linux. I have also been trying to get around this. Secondly, the no-frills way to SSH in is using ash shell. I'll pull out a docker image so people who know how to fix it, can quickly get in started :) |
I also see 97 which I think was bind error. It works on OSX thru KVM. You'll also see 255 error if it's starting on boot. @aronsky said it's simply the hard coded system calls in getting a TCP socket in both the QEMU side and the tunnel in the xnu-qemu-arm64 tools folder. If anyone knows how to change that to Unix ports that would be coolio. OR the easiest way to leap over it is possibly emulating the Darwin kernel via qemu which is what I have to do to ssh in, but it's heavy as I'm booting OSX each time. Maybe qiling framework or usercorn can remap those system calls automatically? |
Here's his write up, https://alephsecurity.com/2020/03/29/xnu-qemu-tcp-tunnel/ Would be awesome to get the tunnel working on GNU/Linux! |
Hi, @MCApollo, the error in tcp-tunnel happens here: https://github.com/alephsecurity/xnu-qemu-arm64-tools/blob/master/tcp-tunnel/src/main.c#L295. This call to connect is handled by the host (QEMU) here: https://github.com/alephsecurity/xnu-qemu-arm64/blob/master/hw/arm/guest-socket.c#L128. Can you debug your execution of QEMU, set a breakpoint there, and verify that the passed |
@aronsky https://gist.github.com/MCApollo/9b26e3986634515f6430bb040891b145 I don't really write C code that often, but that looks right; Let me know if you need any other information. |
It seems you set the breakpoint on |
Sorry about that, beat me to the edit. I can't hit the breakpoint in
|
sys/errno.h: and there's no define for Edit
I'm starting to think that the mismatch of headers is causing a issue and is the root of the problem: |
Hm... It's interesting that the |
Executed the example.com example and tried to connect to localhost, but for the life of me I can’t reproduce the issue in the picture. Did mess with /etc/interfaces in the last couple days, if that’s some insight. |
What are the arguments to tcp-tunnel when you hit the breakpoint in |
There we go, the wget/example.com combo; connect happens on out, my bad.
Arguments for No errors for the wget example, the connection now just doesn’t go through. |
@MCApollo so excited! Can you push to your repo if you got the tunnel working on Linux? I pulled from your repo last night, I'll push my changes including Dockerfile. Were you able to resize the disk on Linux? I can mount and edit, just can't resize |
@MCApollo okay, looking good. However, the value of |
I don't think so - never ran into this issue before (and we never added a SIM card or a WiFi network to our machine). |
|
@MCApollo @aronsky could be that we've disabled SLIRP? Also regarding editing dyld cache so I can connect the debugger, is it normal that it takes a very long time to open? Thirdly, I noticed that the 2 disks mount properly in MacOSX but don't mount both in Linux, I'll get a screenshot. That could be the issue regarding permissions. |
@MCApollo - interesting. So the call to |
@aronsky Let's recap then Binding
Connecting
No error, but no data throughput
Again, did plug a Ethernet cord into the box, was using a usb-wifi dongle before but the box could connect to the internet fine. Bit a pain to test anything, launchd yells about issues and I haven't had the time to pull a different bootstrap off some recent jailbreak. Thanks for looking into this. |
Hm... So the ports seem wrong in both cases. Strange... I wonder what could cause that? Edit: scratch that. It's network endianness. Not sure what could be wrong here... |
ah, you’re right, congrats 🎉 |
MCApollo/xnu-qemu-arm64-tools@bb284ed With that edit and botch-recreating I’ll continue to look into the wrong port number and hang when waiting for a connection. |
I only see one mounted file system when running on Linux. On OSX, the dirty RAM disk mounts as well. Only 1 mounted fs on Linux I have to attach reattach hfs.main to be able to boot in, on OSX. What about QEMU nesting the OSX qemu binary? That's essentially how I boot in now |
Also @MCApollo Thanks for bringing the QEMU version up. I can't build it without the proxmox backup header file, how'd you get around that? I've tried adding -disable-... proxmox backup, I tried removing every reference in pbs.c and the makefile, how'd you do it? |
@aronsky Figured it out, darwin still uses
Using
|
I'm gonna try running the macOS qemu using https://github.com/darlinghq/darling |
Awesome! |
So damn excited 😝😋 |
@MCApollo Feel free to post notes, I have time to help with the PR |
A few days ago, I wanted to try to make a buildserver out of this project (fork here), so I updated the source to qemu 5.0.0 and apply some PVE/Proxmox patches so it’ll work with my use case; Sadly there’s no serial output, but I’m trying to see if maybe iOS is continuing to run in the background.
I’ve been having some trouble SSH’ing into iOS with tcp-tunnel and see if someone maybe knows a answer; The distro is debian buster and my thoughts are a header conflict between apple-darwin and gnu-linux, help would be appreciated, Thanks!
The text was updated successfully, but these errors were encountered: