mcpField
B
bypassing-authentication-with-forced-browsing

bypassing-authentication-with-forced-browsing

github.com/mukul975安全35.2k324 次安装8 周前更新
代码仓库

关于 bypassing-authentication-with-forced-browsing

面向授权渗透测试的安全测试技能,用于检查 Web 应用是否一致地执行身份验证。它结合强制浏览,并检查端点、HTTP 方法、路径规范化及暴露文件。

主要功能

  1. 01枚举隐藏路径和文件
  2. 02检查发现端点的身份验证
  3. 03测试其他 HTTP 方法
  4. 04探测路径规范化绕过
  5. 05搜索暴露的备份和配置文件

适用场景

  1. 01审计管理页面的身份验证
  2. 02检查 API 端点是否缺少会话验证
  3. 03在安全审计中查找暴露的备份文件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill bypassing-authentication-with-forced-browsing

安装后在 Claude Code 中输入/bypassing-authentication-with-forced-browsing确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LICENSE
references/
api-reference.md
scripts/
agent.py

详细介绍

通过强制浏览绕过身份验证

何时使用

  • 在获得授权的渗透测试中,用于发现隐藏或未受保护的管理页面
  • 在测试身份验证是否在所有应用程序端点上一致强制执行时
  • 用于识别遗留在生产环境中的备份文件、配置文件和调试接口
  • 在评估本应要求身份验证的 API 端点上的访问控制时
  • 在安全审计中,用于验证所有敏感资源是否都强制执行会话验证

前置条件

  • 授权:涵盖目录枚举的书面渗透测试协议
  • ffuf:快速 Web 模糊测试工具(go install github.com/ffuf/ffuf/v2@latest)
  • Gobuster:目录暴力破解工具(apt install gobuster)
  • Burp Suite:用于拦截和分析请求与响应
  • 字典:SecLists 集合(git clone https://github.com/danielmiessler/SecLists.git)
  • 目标访问权限:网络连接能力,以及用于已认证对比的有效测试凭据

工作流

第 1 步:枚举隐藏目录和文件

使用 ffuf 或 Gobuster 发现应用程序导航中未链接的路径。

# Directory enumeration with ffuf
ffuf -u https://target.example.com/FUZZ \
  -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt \
  -mc 200,301,302,403 \
  -fc 404 \
  -o results-dirs.json -of json \
  -t 50 -rate 100

# File enumeration with common extensions
ffuf -u https://target.example.com/FUZZ \
  -w /usr/share/seclists/Discovery/Web-Content/raft-medium-files.txt \
  -e .php,.asp,.aspx,.jsp,.html,.js,.json,.xml,.bak,.old,.txt,.cfg,.conf,.env \
  -mc 200,301,302,403 \
  -fc 404 \
  -o results-files.json -of json \
  -t 50 -rate 100

# Gobuster for directory enumeration
gobuster dir -u https://target.example.com \
  -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt \
  -s "200,204,301,302,307,403" \
  -x php,asp,aspx,jsp,html \
  -o gobuster-results.txt \
  -t 50
第 2 步:发现管理接口和调试接口

针对常见的管理路径和调试端点。

# Admin panel enumeration
ffuf -u https://target.example.com/FUZZ \
  -w /usr/share/seclists/Discovery/Web-Content/common.txt \
  -mc 200,301,302 \
  -t 50 -rate 100

# Common admin paths to check manually:
# /admin, /administrator, /admin-panel, /wp-admin
# /cpanel, /phpmyadmin, /adminer, /manager
# /console, /debug, /actuator, /swagger-ui
# /graphql, /graphiql, /.env, /server-status

# API endpoint discovery
ffuf -u https://target.example.com/api/FUZZ \
  -w /usr/share/seclists/Discovery/Web-Content/api/api-endpoints.txt \
  -mc 200,201,204,301,302,401,403 \
  -fc 404 \
  -o api-results.json -of json

# Check for Spring Boot Actuator endpoints
for endpoint in env health info beans configprops mappings trace; do
  curl -s -o /dev/null -w "%{http_code} /actuator/$endpoint\n" \
    "https://target.example.com/actuator/$endpoint"
done
第 3 步:测试已发现端点上的身份验证强制执行情况

对比未认证请求与已认证请求之间的响应。

# Test without authentication
curl -s -o /dev/null -w "%{http_code}" \
  "https://target.example.com/admin/dashboard"

# Test with valid session cookie
curl -s -o /dev/null -w "%{http_code}" \
  -b "session=valid_session_token_here" \
  "https://target.example.com/admin/dashboard"

# Automated check: compare response sizes
# Unauthenticated request
curl -s "https://target.example.com/admin/users" | wc -c

# Authenticated request
curl -s -b "session=valid_token" \
  "https://target.example.com/admin/users" | wc -c

# If both return similar content, authentication is not enforced

# Test with Burp Intruder: send a list of discovered URLs
# without cookies and flag any 200 responses
第 4 步:测试基于 HTTP 方法的身份验证绕过

某些应用程序仅对特定的 HTTP 方法强制执行身份验证。

# Test different HTTP methods on protected endpoints
for method in GET POST PUT DELETE PATCH OPTIONS HEAD TRACE; do
  echo -n "$method: "
  curl -s -o /dev/null -w "%{http_code}" \
    -X "$method" "https://target.example.com/admin/settings"
done

# Test HTTP method override headers
curl -s -o /dev/null -w "%{http_code}" \
  -X POST \
  -H "X-HTTP-Method-Override: GET" \
  "https://target.example.com/admin/settings"

curl -s -o /dev/null -w "%{http_code}" \
  -H "X-Original-Method: GET" \
  -H "X-Rewrite-URL: /admin/settings" \
  "https://target.example.com/"
第 5 步:测试路径遍历和 URL 规范化绕过

利用 URL 解析差异绕过基于路径的身份验证规则。

# Path normalization bypass attempts
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/admin/dashboard"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/ADMIN/dashboard"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/admin/./dashboard"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/public/../admin/dashboard"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/admin%2fdashboard"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/;/admin/dashboard"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/admin;anything/dashboard"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/.;/admin/dashboard"

# Double URL encoding
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/%2561dmin/dashboard"

# Trailing characters
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/admin/dashboard/"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/admin/dashboard.json"
curl -s -o /dev/null -w "%{http_code}" "https://target.example.com/admin/dashboard%00"
第 6 步:发现备份文件和配置文件

搜索无意中暴露在 Web 服务器上的敏感文件。

# Backup file discovery
ffuf -u https://target.example.com/FUZZ \
  -w /usr/share/seclists/Discovery/Web-Content/raft-medium-files.txt \
  -e .bak,.old,.orig,.save,.swp,.tmp,.dist,.config,.sql,.gz,.tar,.zip \
  -mc 200 -t 50 -rate 100

# Common sensitive files
for file in .env .git/config .git/HEAD .svn/entries \
  web.config wp-config.php.bak config.php.old \
  database.yml .htpasswd server-status phpinfo.php \
  robots.txt sitemap.xml crossdomain.xml; do
  status=$(curl -s -o /dev/null -w "%{http_code}" \
    "https://target.example.com/$file")
  if [ "$status" != "404" ]; then
    echo "FOUND ($status): $file"
  fi
done

# Git repository exposure check
curl -s "https://target.example.com/.git/HEAD"
# If this returns "ref: refs/heads/main", the git repo is exposed

关键概念

概念描述
强制浏览直接访问未链接但存在于服务器上的 URL
目录枚举根据字典对目录名和文件名进行暴力破解,以发现隐藏内容
身份验证绕过由于缺少访问检查,在没有有效凭据的情况下访问受保护资源
路径规范化利用 Web 服务器与应用程序框架解析 URL 路径方式的差异
基于方法的绕过使用可能没有身份验证检查的替代 HTTP 方法(PUT、DELETE)
信息泄露敏感配置文件、备份或调试接口的暴露
纵深防御在多个层级强制执行身份验证的分层安全控制

工具与系统

工具用途
ffuf用于目录、文件和参数枚举的快速 Web 模糊测试工具
Gobuster使用 Go 编写的目录和 DNS 暴力破解工具
Feroxbuster具备自动递归功能的递归内容发现工具
DirBuster基于 Java 且带 GUI 的 OWASP 目录暴力破解工具
Burp Suite用于请求拦截和自动化扫描的 HTTP 代理
SecLists用于安全测试的综合性字典集合

常见场景

场景 1:暴露的管理面板

位于 /admin/ 的管理面板仅通过不在导航中链接来隐藏。直接访问 URL 即可在没有任何身份验证检查的情况下暴露完整的管理界面。

场景 2:未受保护的 API 端点

位于 /api/v1/users 和 /api/v1/settings 的 API 端点在前端应用程序中要求身份验证,但后端 API 并未强制执行会话验证,从而允许未认证的直接访问。

场景 3:包含凭据的备份文件

某位开发人员将 config.php.bak 留在了生产服务器上。该备份文件以明文形式包含数据库凭据,是通过基于扩展名的枚举发现的。

场景 4:Spring Boot Actuator 暴露

/actuator/env 端点在没有认证的情况下暴露,泄露了包括数据库连接字符串、API 密钥和密钥在内的环境变量。

输出格式

## Forced Browsing / Authentication Bypass Finding

**Vulnerability**: Missing Authentication on Administrative Interface
**Severity**: Critical (CVSS 9.1)
**Location**: /admin/dashboard (GET, no authentication required)
**OWASP Category**: A01:2021 - Broken Access Control

### Discovered Unprotected Resources
| Path | Status | Auth Required | Content |
|------|--------|---------------|---------|
| /admin/dashboard | 200 | No | Full admin panel |
| /admin/users | 200 | No | User management |
| /actuator/env | 200 | No | Environment variables |
| /config.php.bak | 200 | No | Database credentials |
| /.git/HEAD | 200 | No | Git repository metadata |

### Impact
- Unauthenticated access to administrative functions
- Ability to create, modify, and delete user accounts
- Exposure of database credentials and API keys
- Full source code disclosure via exposed Git repository

### Recommendation
1. Implement authentication checks at the server/middleware level for all admin routes
2. Remove backup files, debug endpoints, and version control metadata from production
3. Configure web server to deny access to sensitive file extensions (.bak, .old, .env, .git)
4. Implement IP-based access restrictions for administrative interfaces
5. Use a reverse proxy to restrict access to internal-only endpoints

评论

支持 Markdown