Remote 0click exfiltration of Safari user's IP address
Twitter pages included preconnect hints to third-party domains, so Safari would open a connection to those domains before the user clicked anything. An attacker who controlled such a domain could learn a targeted visitor's IP address and hostname without any interaction.
- Triaged in 5 months
- Fixed in 7 months
- Paid in 6 months
- Disclosed after 7 months
Summary by the researcher
Category: Flaws leaking PII.
The report
NOTE! Thanks for submitting a report! Please replace all the [square] sections below with the pertinent details. Remember, the more detail you provide, the easier it is for us to triage and respond quickly, so be sure to take your time filling out the report!
Summary: A malicious actor when embedding content into Twitter content (for example, see this ████) can lookup the IP address of a user without the user consenting to loading the 3rd party domain.
Description: When the user loads the page and doesn't click on any content Safari preloads the ad target domain (in this case ██████████). Using that, without the user tapping on the link, my server receives a TCP connection where I extract the IP and hostname of the victim. Using that information, I can lookup their approximate address, maybe spoof an IP in their city and spearphish one of their accounts, find their telco or ISP provider and use their twitter name to take over their account, many things are possible.
The problem is caused by use of remote domain links with preconnect.
<link href="https://██████" rel="preconnect"> <link href="//███████" rel="preconnect">I recommend a mitigation of removing preload and preconnect for 3rd party domains.
This has huge privacy and security implications. I can remotely extract a targeted user's IP address by sending them a email, text message, or just tweeting at them. They are not aware it happened, it doesn't show up in their browser history because the user doesn't tap on the 3rd party link.
Once you have mitigated this issue I will need to notify Apple.
Steps To Reproduce:
(Add details for how we can reproduce the issue)
- I send a targeted user a link to a tweet such as https://twitter.com/██████/status/███████
- They use Safari to open the link
- When the user mouses over the image on a mac (or scrolls the screen on an iPhone) Safari will connect to ████.
- My server lists out incoming TCP connections.
Impact:
Silently exfiltrating a user's IP address remotely opens them up to lots of attacks. You may see an egg, but I see a gateway to spear phishing the user by initiating regular MITM attack (showing the login request from the same location as the user), I see it been useful to do an account takeover via their ISP or telco. I see it useful to know when a user is at home or at work, in some cases I can tell they work at a certain company. In the case of a popular streamer it opens them up to DDOS attacks by just clicking on a "safe" tweet. There are huge possibilities for doxxing individuals using this exploit.
You can also target an individual (for example an individual you know is in America somewhere) through twitter ads by adding 99 twitter handles from Japan, then the target twitter handle. That way, you know when your ad is shown if it is the target because they won't be in Japan.
The only thing to bring down the impact of this attack is it is macOS and iOS Safari only. But if you don't think this attack has high severity I can demonstrate more use cases.
Supporting Material/References:
- List any additional material (e.g. screenshots, logs, etc.)
Here is a simple C server for logging incoming 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);
}
}
Impact
Silently exfiltrating a user's IP address remotely opens them up to lots of attacks. You may see an egg, but I see a gateway to spear phishing the user by initiating regular MITM attack (showing the login request from the same location as the user), I see it been useful to do an account takeover via their ISP or telco. I see it useful to know when a user is at home or at work, in some cases I can tell they work at a certain company. In the case of a popular streamer it opens them up to DDOS attacks by just clicking on a "safe" tweet. There are huge possibilities for doxxing individuals using this exploit.
You can also target an individual (for example an individual you know is in America somewhere) through twitter ads by adding 99 twitter handles from Japan, then the target twitter handle. That way, you know when your ad is shown if it is the target because they won't be in Japan.
The only thing to bring down the impact of this attack is it is macOS and iOS Safari only. But if you don't think this attack has high severity I can demonstrate more use cases.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The page used preconnect link hints pointing at third-party domains, causing Safari to contact those domains before any user action.
Impact
An attacker could silently learn a targeted Safari user's IP address and hostname, which the reporter says could aid spearphishing, doxxing or denial of service; the issue was limited to macOS and iOS Safari.
What the attacker needed
Victim uses Safari on macOS or iOS; victim opens a crafted tweet link; attacker controls the hinted domain
The fix
Preload and preconnect hints for third-party domains should be removed.
How it was found
- Send a targeted user a link to a tweet containing the third-party preconnect hint.
- The user opens the link in Safari.
- When the user hovers over the image on a Mac or scrolls on an iPhone, Safari connects to the third-party domain.
- The attacker's server logs the incoming connection and extracts the IP address and hostname.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Browsers sometimes open connections to other websites early to make pages load faster; this is called preconnect. Here, a page told Safari to connect to a domain the attacker owned, so the attacker's server saw the visitor's network address even though the visitor never clicked. That address can hint at where someone lives or which network they use.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.