Any OpenSource SOCKS proxy server for Android? I am looking for a SOCKS proxy server I can run on my Android phone. I could only find some commercial apps, but would prefer a FOSS alternative.

It does not need to be an app: a binary I can run from adb shell would work as well, but I'd prefer it if it does not require root.
Use SSH!
You can use the FOSS application SimpleSSHD for this! You can get it directly from that link or using the F-droid app store on your phone.
Once setup you can connect to your device using either your LAN or WAN IP from your PC like this:
ssh -D 8899 &lt;PHONE-IP&gt;

The -D option sets up a local &quot;dynamic&quot; application-level port forwarding, which essentially makes ssh act like a SOCKS5 (SOCKS4 is supported aswell) proxy server.
After this, you can set your proxy to 127.0.0.1:8899 on your PC. I've tested it with curl:
curl --socks5 127.0.0.1:8899 https://myip.is

And it worked! Note that I did not even need root for this, it worked as the normal android user.
Note that if you want to use your mobile network for this your cell provider might not let you connect to SSHD using the WAN IP. A VPN can cirucmvent this if neccessary.