🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #331215

Re: It's become mail2dizum

#331215
From: Billy G.
Date: Sat, 13 Sep 2025 09:48
188 lines
6986 bytes
On 13.09.25 03:20, Soul Patch wrote:
> Torsocks is insecure and can leak data. It only uses ENV variables which can be disregarded by bad software and scripts, especially anything that is statically compiled.
> 

is INN(feed) statically compiled? I'd think: no.
review calls in INN codebase and see what's in use...
or jump to mid of the message here and try the idea.

>> explain the magic how tsocks or proxychains work .

Excellent question! Yes, tsocks and proxychains do work somewhat
"magically" by intercepting network calls at the system level.

Here's how they accomplish this:

## **The Magic: LD_PRELOAD and Function Interception**

Both tools use a technique called **library preloading** via the
`LD_PRELOAD` environment variable:

```bash
# What proxychains actually does internally:
LD_PRELOAD=./libproxychains.so.3 innfeed

# What tsocks does:
LD_PRELOAD=/usr/lib/libtsocks.so innfeed
```

## **How Function Interception Works**

1. **Normal application flow:**
```c
// Application calls standard socket functions
int socket_fd = socket(AF_INET, SOCK_STREAM, 0);
connect(socket_fd, &server_addr, sizeof(server_addr));  // Direct connection
```

2. **With proxychains/tsocks:**
```c
// The preloaded library intercepts the connect() call
int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
    // This is now the proxychains/tsocks version, not the system one!

    // Extract destination from original connect() call
    char *dest_ip = inet_ntoa(((struct sockaddr_in*)addr)->sin_addr);
    int dest_port = ntohs(((struct sockaddr_in*)addr)->sin_port);

    // Instead of connecting directly, connect to SOCKS proxy
    struct sockaddr_in proxy_addr;
    proxy_addr.sin_addr.s_addr = inet_addr("127.0.0.1");  // Proxy IP
    proxy_addr.sin_port = htons(9050);                     // Proxy port

    // Connect to proxy instead
    int result = real_connect(sockfd, (struct sockaddr*)&proxy_addr,
sizeof(proxy_addr));

    // Send SOCKS handshake to proxy with real destination
    socks5_handshake(sockfd, dest_ip, dest_port);

    return result;  // App thinks it connected directly!
}
```

## **Step-by-step Process**

1. **Library Loading**: When you run `proxychains innfeed`, the system
loads the proxychains library before any other libraries
2. **Symbol Interception**: The library provides its own versions of
network functions like `connect()`, `bind()`, `gethostbyname()`
3. **Transparent Redirection**: When innfeed calls
`connect("news.server.com", 119)`, it actually gets the proxychains version
4. **SOCKS Protocol**: The intercepted function connects to the SOCKS
proxy and tells it to connect to the real destination
5. **Data Tunneling**: All subsequent data flows through the proxy tunnel

## **What Gets Intercepted**

```c
// Common functions that get replaced:
connect()      // TCP connections
bind()         // Sometimes for local binding
gethostbyname() // DNS lookups (can be redirected too)
getaddrinfo()  // Modern DNS lookups
send()/recv()  // Sometimes for additional processing
```

## **Why It Works**

- **Dynamic Linking**: Most applications use dynamic linking, so
function calls go through the dynamic linker
- **LD_PRELOAD Priority**: Libraries in LD_PRELOAD are checked first for
symbols
- **Same Function Signatures**: The replacement functions have identical
signatures to the originals
- **Application Ignorance**: The application never knows its calls are
being intercepted

## **Limitations**

```bash
# Won't work with:
- Statically linked binaries (no dynamic linking)
- Applications that bypass standard socket calls
- Programs that use raw sockets
- Applications with security restrictions on LD_PRELOAD
```

## **You Can See It in Action**

```bash
# See what functions are being intercepted
strace -e trace=connect proxychains curl http://example.com

# You'll see the connect() going to 127.0.0.1:9050 instead of example.com:80
```

So yes, it's "magic" in that the application has no idea its network
calls are being rerouted, but it's accomplished through well-established
Unix mechanisms for library interposition!

>>> the idea?

innfeed is started in INN2. Looking at your `/etc/news/newsfeeds` entry:

```
# innfeed funnel master.
innfeed!\
        :!*\
        :Tc,Wnm*:/usr/lib/news/bin/innfeed
```

This is the **funnel master** entry that tells `innd` how to start
innfeed. The key part is:
- `Tc,Wnm*` - flags for the feed type
- `:/usr/lib/news/bin/innfeed` - the actual command to execute

## To add proxy support via proxychains:

You'd modify this line to:

```
# innfeed funnel master with proxy support
innfeed!\
        :!*\
        :Tc,Wnm*:/usr/bin/proxychains /usr/lib/news/bin/innfeed
```

## Or with environment variables:

```
# innfeed funnel master with proxy via env vars
innfeed!\
        :!*\
        :Tc,Wnm*:/bin/sh -c "LD_PRELOAD=/usr/lib/libproxychains.so.4
/usr/lib/news/bin/innfeed"
```

## Alternative approach - wrapper script:

Create `/usr/local/bin/innfeed-proxy`:
```bash
#!/bin/bash
exec proxychains /usr/lib/news/bin/innfeed "$@"
```

Then modify newsfeeds:
```
innfeed!\
        :!*\
        :Tc,Wnm*:/usr/local/bin/innfeed-proxy
```

After modifying `/etc/news/newsfeeds`, you need to:
1. Run `ctlinnd reload newsfeeds 'Added proxy support'`
2. Or restart innd

This way, every time innd spawns innfeed, it will automatically go
through your proxy configuration.



-- 
......
Billy G. (go-while)
https://pugleaf.net
@Newsgroup: rocksolid.nodes.help
irc.pugleaf.net:6697 (SSL) #lounge
discord: https://discord.gg/rh2tGMJWwV
Technical Details
Message-ID: <10a3ekv$2f18q$1@reader-nyc.newsdeef.eu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.pugleaf.net!ygg-srl.newsdeef.eu!srl.newsdeef.eu!reader-nyc.newsdeef.eu!.POSTED!not-for-mail
References: <20250911142203.D80443E631@mail.tcpreset.net> <10a18ai$ltu9$1@news.tcpreset.net> <10a18lk$lucp$1@news.tcpreset.net> <10a1u20$1fujq$1@paganini.bofh.team> <10a212b$mqvr$1@news.tcpreset.net> <10a2keu$1m1fh$1@paganini.bofh.team>

Show Full Headers
Complete Article Headers
Message-ID: <10a3ekv$2f18q$1@reader-nyc.newsdeef.eu>
Subject: Re: It's become mail2dizum
Date: Sat, 13 Sep 2025 10:48:15 +0100
From: "Billy G." <contact-5c2e-000@pugleaf.net>
References: <20250911142203.D80443E631@mail.tcpreset.net> <10a18ai$ltu9$1@news.tcpreset.net> <10a18lk$lucp$1@news.tcpreset.net> <10a1u20$1fujq$1@paganini.bofh.team> <10a212b$mqvr$1@news.tcpreset.net> <10a2keu$1m1fh$1@paganini.bofh.team>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.pugleaf.net!ygg-srl.newsdeef.eu!srl.newsdeef.eu!reader-nyc.newsdeef.eu!.POSTED!not-for-mail
Newsgroups: alt.privacy.anon-server,alt.privacy,sci.crypt
Organization: github.com/go-while
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 13 Sep 2025 09:48:15 -0000 (UTC)
Injection-Info: reader-nyc.newsdeef.eu; posting-account="sys-operator";
 logging-data="2589978"; mail-complaints-to="abuse@newsdeef.eu";
 posting-account="ggUZJXmrQBoB7mitoXQwdxqeYYnnDS0Ezkz+dO8ak5E";
In-Reply-To: <10a2keu$1m1fh$1@paganini.bofh.team>
Content-Language: en-US