诡异事件:访问网站出现一行乱码,运营商新的劫持技术?

2019-01-24 20:44:35 +08:00
 xmlf

有两个网址

A:https://www.snwsjz.com

B:https://wang.jiazu.at

事情经过如下:

1、23 天之前,回父母家用电脑移动宽带访问 B(父亲经常打开的是 A,B 打开很少),出现我在之前帖子中乱码问题。

https://www.v2ex.com/t/522816

乱码中最后跟的字符,竟然是 A 网址的中间部分,也就是父亲经常访问的网址。

用手机 4G 访问一切正常。我改了电脑 DNS 后,也正常了。

在帖子中反映后,大佬说是移动宽带 CDN 问题。。

在这个时候,A 和 B 是两个独立的站,A 还是是 http 协议。

2、因为 B 在百度权重太低,在五天前,我将 B 网址换成了 A 网址,并 301,同事启用 A 启用了 https

今天将 A 网址发给一个人,是江苏电信网络,问我是不是在调试?我说没有啊。。

发截图给我,仍然是同样的乱码。

https://i.bmp.ovh/imgs/2019/01/5ccad713f33982a0.png

手机电信 4G 访问没有任何问题。

而我单位江苏联通、家里江苏电信、移动 4G 访问都没任何问题。

诡异的地方在于:

1、23 天之前,访问 B 网址,为什么出现乱码中会有 A 网址的英文字母

2、今天电信宽度访问 A 网址,出现的乱码和 23 天之前一样。

另外说一下网站启用了反向代理。。。

出现的乱码是: �벻Ҫ�Ƿ����ʣ���������ӹ��ں�snwsjz

贴一下反代配置:

http
    {
        include       mime.types;
        default_type  application/octet-stream;

        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 50m;

        sendfile   on;
        tcp_nopush on;

        keepalive_timeout 60;

        tcp_nodelay on;
   		proxy_connect_timeout 300s; 
    	proxy_read_timeout 300s; 
    	proxy_send_timeout 300s;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 256k;
	# gzip
	gzip on;
	gzip_vary on;
#	gzip_proxied any;
	gzip_comp_level 6;
	gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
	#limit_req_zone $binary_remote_addr zone=jiazu:3m rate=12r/m;
        #limit_conn_zone $binary_remote_addr zone=perip:10m;
        ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.
        server_tokens off;
        access_log off;
        server
    {
        listen 80;
        #listen [::]:80;
server_name www.snwsjz.com snwsjz.com;
rewrite ^(.*)$	https://$host$1	permanent;
}
server
   {
       listen 443 ssl http2;
       #listen [::]:443 ssl http2;
       server_name www.snwsjz.com snwsjz.com;
if ($host = "snwsjz.com")
{
rewrite ^(.*)$  https://www.snwsjz.com$1      permanent;
}
        ssl_certificate /xxx.cer;
        ssl_certificate_key /xxx.key;
        ssl_session_timeout 5m;
	ssl_early_data on;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        ssl_session_cache builtin:1000 shared:SSL:10m;
        # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
        ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
        #include rewrite/none.conf;
        #error_page   404   /404.html;
# security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
# . files
location / {
proxy_pass          http://xxxxxx;
proxy_redirect      off;
proxy_http_version      1.1;
proxy_cache_bypass      $http_upgrade;
proxy_set_header Upgrade                        $http_upgrade;
proxy_set_header Connection             "upgrade";
proxy_set_header Host                           $host:$server_port;
proxy_set_header X-Real-IP                      $remote_addr;
proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-For       $remote_addr;
proxy_set_header X-Forwarded-Proto      $scheme;
proxy_set_header X-Forwarded-Host       $host;
proxy_set_header X-Forwarded-Port       $server_port;
}
1485 次点击
所在节点    问与答
11 条回复
oott123
2019-01-24 21:16:14 +08:00
回源劫持。简单的说,你的反代服务器通过 http 协议回源,然后在回源的过程中被劫持了。
Showfom
2019-01-24 21:22:26 +08:00
proxy_pass http://xxxxxx;

用 https 回源吧
uuair
2019-01-24 21:25:42 +08:00
对,比如月光博客就这德行了。
xmlf
2019-01-25 07:25:25 +08:00
@oott123 我的源站和反代站服务器都在美国洛杉矶……这样也会发生劫持?
xmlf
2019-01-25 07:26:16 +08:00
@Showfom https 回源不是要手动生成证书了
msg7086
2019-01-25 08:48:17 +08:00
@xmlf 生成证书也叫事啊……?
xmlf
2019-01-25 08:53:34 +08:00
@msg7086 这个不是事。。。我意思是,我源站和代理站都在美国。就是之间用 http,也不会受到劫持干扰啊。。
而且诡异的事,23 天之前,后面跟的字符 snwsjz 是另一个站域名。。。

我发现这种情况出现在用户第一次访问时出现。
xmlf
2019-01-25 10:31:13 +08:00
能有大佬帮助分析吗
oott123
2019-01-25 14:25:21 +08:00
美国的月亮比较园所以不会有人劫持?先换上排除一下再说。
oott123
2019-01-25 14:25:58 +08:00
s/园 /圆 /。打错字了。
xmlf
2019-01-25 17:05:22 +08:00
@oott123 OK,我已经在后端也启用了 https。
估计不是这个问题。。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/530373

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX