how to share virtual box VPN to Host OS ?

TL;DR Just use an SSH tunnel.

I’d recommend to proxy traffic through your VM so you can use GUIs on your Host for HTTP/S, FTP, SSH and so on. No install or server config needed, SSH got your back. Just add a dynamic tunnel in PuTTY, use localhost:localport as SOCKSv5 Proxy in your GUIs.

Or…

HTB VPN only assigns 1 IPv4 to you and AFAIK you can only connect once. To route packets from 2 sources through the same IP (and back) you need NAT/Masquerading, which requires port forwarding through your NAT so incoming connections are routed to the appropriate endpoint. You’d need to set up NAT rules so, for example, ports 9000:9009 incoming are DNAT’ed to your VM and 9010:9019 are DNAT’ed to your Host for reverse shells.

Connections from your clients to HTB would work fine with masquerading (SNAT on your end) but some protocols don’t like that and it makes for a “fun” experience when debugging connections… “Server sent traffic back to 34567/tcp, but that’s not even open on my machine?!”

You’d need to set a static route for the HTB VPN subnet on your Host to your (local) VM IP as gateway (10.0.0.0/8 via 172.17.0.2), and configure Masquerading on your VM using IPtables (SRC 172.17.0.1/32 IN eth0 TO 10.0.0.0/8 OUT tun0 -j MASQ). Just start the VPN and your Host will be able to access HTB, no tunnels or proxies to configure. Some port scanning might even work with additional ICMP rules(?), but I still wouldn’t use that connection for anything but web browsing.

I can recommend trying that set-up for the learning experience, if you get it right it’ll mostly work and you’ll learn invaluable stuff, especially if you have or aim for a career in IT. IF you get it right, that is. Because “that” is basically a complete router config. But there are plenty of tutorials out there. I learned from TLDP which explains all concepts in great detail. I still use that knowledge from 10 years ago in my dayjob.

But then again, setting up a dynamic tunnel in PuTTY takes less time than reading this post. Thank me later.