WordPress 的管理员账户很容易就能获取,虽然说拿到了管理员账号,用处不是很大,但是不排除有些小白的密码是简单的数字密码。被攻击者爆破或者撞库成功,从而获得后台的管理员账户。
那么。攻击者是怎样拿到你的Wordpress 【管理员用户名】的,以及如何保护自己的管理员账户不被获取,这篇文章就来谈谈!!!
攻击者或者攻击程序构造了:https://你的域名/wp-json/wp/v2/users/
的URL进行GET,这样99%会返回一串信息,里面包含了你的管理员账户。如下:
[{"id":1,"name":"\u964c\u6d9b","url":"https:\/\/www.imotao.com","description":"\u8fd9\u4e2a\u535a\u4e3b\u5f88\u61d2\uff0c\u61d2\u6b7b\u4e86\u3002","link":"https:\/\/www.imotao.com\/author\/imotao","slug":"imotao","avatar_urls":{"24":"https:\/\/secure.gravatar.com\/avatar\/da2867019057f50c669f3db99c7edf91?s=24","48":"https:\/\/secure.gravatar.com\/avatar\/da2867019057f50c669f3db99c7edf91?s=48","96":"https:\/\/secure.gravatar.com\/avatar\/da2867019057f50c669f3db99c7edf91?s=96"},"meta":[],"_links":{"self":[{"href":"https:\/\/www.imotao.com\/wp-json\/wp\/v2\/users\/1"}],"collection":[{"href":"https:\/\/www.imotao.com\/wp-json\/wp\/v2\/users"}]}}]
以上信息可以发现:imotao就是管理员账号,真实已被隐藏,这里只为了演示。
其实上面的代码差不多已经确认你用的是wp程序了,这里还是提及一下:
攻击者或者攻击程序通过构造 https://你的域名//wp-includes/wlwmanifest.xml
的URL进行GET,来判断你是否使用了Wordpress程序。以及你的后台登录地址!输入后你会得到这样的反馈。所以修改后台登录地址很重要。
<manifest xmlns="http://schemas.microsoft.com/wlw/manifest/weblog">
<options>
<clientType>WordPress</clientType>
<supportsKeywords>Yes</supportsKeywords>
<supportsGetTags>Yes</supportsGetTags>
</options>
<weblog>
<serviceName>WordPress</serviceName>
<imageUrl>images/wlw/wp-icon.png</imageUrl>
<watermarkImageUrl>images/wlw/wp-watermark.png</watermarkImageUrl>
<homepageLinkText>View site</homepageLinkText>
<adminLinkText>Dashboard</adminLinkText>
<adminUrl>
<![CDATA[ {blog-postapi-url}/../wp-admin/ ]]>
</adminUrl>
<postEditingUrl>
<![CDATA[ {blog-postapi-url}/../wp-admin/post.php?action=edit&post={post-id} ]]>
</postEditingUrl>
</weblog>
<buttons>
<button>
<id>0</id>
<text>Manage Comments</text>
<imageUrl>images/wlw/wp-comments.png</imageUrl>
<clickUrl>
<![CDATA[ {blog-postapi-url}/../wp-admin/edit-comments.php ]]>
</clickUrl>
</button>
</buttons>
</manifest>
攻击者还会通过构造 < https://你的域名?author=1 //?author=2 //?author=3> 来确认你的管理员id,以此来和上面的匹配。
既然知道了,那么如何防护呢,继续往下看吧。
location ~ ^/wp-json/wp/v2/users {
deny all;
}
location ~ ^/wp-includes/wlwmanifest.xml {
deny all;
}
这时候访问上述网页,就会被屏蔽结果。如图:
在禁止访问的url中添加以下规则:
/wp-json/wp/v2/users
/wp-includes/wlwmanifest.xml
这其实不是个漏洞,所以不用紧张,其实稍微注意点安全的小伙伴早就修改了一个非常强壮的密码,隐藏了登录后台,禁用了xmlrpc.php。
location ^~ /xmlrpc.php { return 403; }
是否禁用根据自己需要吧,如果出现升级错误,那么可以删除掉或者禁用掉代码即可。
2)其实有一些主题的管理员账号是显示在文章里面的,感觉这样真的是……,我们可以在wp后台设置一个昵称,这样文章会显示昵称在文章中。
3)各位小伙伴可以通过以上URL测试一下自己的Wordpress站点。看看是不是可以拿到敏感信息。如果特别敏感,就赶紧设置权限。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。