看我如何通过邮箱获取IP定位-复现

 

环境准备:一台部署了phpstudy 的vps

脚本内容:get_ip.php

  该脚本可以生成一个十分隐蔽的图片,并获取客户端的一些敏感信息。

代码内容如下:

 1 <?php
 2 //show_source(__FILE__);
 3 header('Content-Type:image/png');
 4 function get_ip()
 5 {
 6     static $ipFrom = ['HTTP_CLIENT_IP','HTTP_X_FORWARDED_FOR','HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP','HTTP_FORWARDED_FOR','HTTP_FORWARDED','REMOTE_ADDR'];
 7     foreach ($ipFrom as $key) {
 8         if (array_key_exists($key, $_SERVER)) {
 9             foreach (explode(',', $_SERVER[$key]) as $ip) {
10                 $ip = trim($ip);
11                 if ((bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
12                     return $ip;
13                 }
14             }
15         }
16     }
17     return  '127.0.0.1';
18 }
19 
20 $im = imagecreatetruecolor(1,1);
21 $backgroud_color = imagecolorallocatealpha($im, 255, 255, 255, 127);
22 imagepng($im);
23 imagedestroy($im);
24 
25 $ip = get_ip();
26 // $ip = "IP: " + (string)$ip;
27 $from = $_SERVER['HTTP_REFERER'];
28 // $from = "From: " + (string)$from;
29 $client = $_SERVER['HTTP_USER_AGENT'];
30 // $client = "Client: " + (string)$client;
31 $myfile = fopen('1.txt', a) or die('Unable to open file');
32 //将这些信息保存到1.txt
33 fwrite($myfile,"IP: ".$ip);
34 fwrite($myfile, "From: ".$from);
35 fwrite($myfile, "Client: ".$client);
36 fwrite($myfile, "\n");
37 fclose($myfile);
38 
39 ?>

 

效果图:

 

  图1

发送邮件:

编辑邮件后如图,这个邮件仔细看有个小点,就是那个php文件。

 

 查看收件人的一些敏感信息:

 

 

 

 

总结:

  1.gmail的安全性怎么做的这么好

  2.qq,腾讯企业邮 ,outlook可以使用

   3.protonmail加载图片会失败,也不能获取客户端IP

原文:

技术讨论 | 看我如何通过邮箱获取IP定位 - FreeBuf互联网安全新媒体平台
http://www.freebuf.com/articles/database/185954.html

posted @ 2018-10-17 21:41  壹個人坐在角落  阅读(781)  评论(0编辑  收藏  举报