🌎 SecGPT-14B-Reasoning

让 SecGPT 具备深度思考的能力 | Empowering SecGPT with Deep Reasoning Capabilities


🧠 模型简介 | Model Overview

SecGPT-14B-Reasoning 是基于 SecGPT-14B 的增强型网络安全大模型,首次引入 动态推理模式切换 能力,支持与 Qwen3 的 "思考-非思考模式" 无缝兼容。该模型通过强化逻辑推导与因果分析能力,在复杂安全场景中实现更精准的威胁研判与决策支持。

SecGPT 是由 云起无垠 于 2023 年正式推出的开源大模型,专为网络安全场景打造,旨在以人工智能技术全面提升安全防护效率与效果。

中文
动态模式:自由切换 "深度推理" 与 "快速响应" 模式
🚀 场景适配:红队战术推演 / 蓝队威胁狩猎 / 自动化安全运营
🔍 知识增强:集成 CWE、CVE、ATT&CK 等权威安全知识库

English
Dynamic Modes: Switch between "Deep Reasoning" and "Fast Response" modes
🚀 Scenario Adaptation: Red Team tactics simulation / Blue Team threat hunting / Automated security operations
🔍 Knowledge-Enhanced: Integrated with authoritative databases like CWE, CVE, ATT&CK

启用思考模式 | Enable reasoning mode

/think 分析以下日志中的潜在 APT 攻击链特征。

禁用思考模式 | Disable reasoning mode

/no_think 总结攻击链的关键节点。


Use Cases

User: SpringBoot常见的接口路由泄露有哪些?列举Swagger相关路径

Assistant: 首先,我需要分析SpringBoot中常见的接口路由泄露问题,并特别关注与Swagger相关的路径。Swagger是一个流行的API文档工具,如果配置不当,可能会导致敏感信息泄露。接下来,我会列举出这些路径,并解释它们可能带来的安全风险。

在SpringBoot项目中,常见的接口路由泄露问题主要集中在Swagger相关路径上。以下是几个需要注意的路径:

  1. /swagger-ui.html:这是Swagger的默认UI界面,如果未进行访问控制,攻击者可以通过该路径直接查看API文档,了解系统的接口结构和潜在漏洞。

  2. /api-docs:这是Swagger生成的API文档的JSON格式输出,通常用于自动化测试或生成客户端代码。如果未进行保护,可能会泄露系统内部的详细接口信息。

  3. /swagger-resources:该路径返回Swagger资源列表,包括API定义文件的位置。如果未限制访问,攻击者可以获取到更多的系统信息。

  4. /v2/api-docs:这是Swagger API文档的另一种格式,类似于/api-docs,但通常更详细。同样,如果没有适当的保护措施,可能会导致敏感信息泄露。

  5. /swagger.json:这是Swagger的配置文件,包含API文档的相关信息。如果暴露在外,可能会被攻击者利用来进一步探测系统。

为了防止这些路径的泄露,建议采取以下措施:

  • 禁用Swagger UI:通过配置禁用Swagger的Web UI。
  • 限制访问:使用Spring Security或其他安全框架对这些路径进行访问控制,确保只有授权用户才能访问。
  • 隐藏配置:避免将Swagger配置文件暴露在公开可访问的路径上。

通过以上措施,可以有效减少接口路由泄露的风险,提高系统的安全性。

User: 如何编写一个Suricata规则,用于检测png_handle_sPLT中潜在的整数溢出漏洞,特别是针对libPNG库中的分配过程,在HTTP端口的TCP流量中进行检测?

Assistant: 为了编写一个有效的Suricata规则来检测png_handle_sPLT中的整数溢出漏洞,我们需要考虑以下几点:

  1. 确保规则能够捕捉到特定的HTTP流量(通常是80端口)。
  2. 检测特定的字符串模式,这些模式与libPNG库的sPLT处理相关。
  3. 使用正确的协议和流量方向来匹配HTTP流量。
  4. 确保规则能够准确识别并触发警报。

根据您的要求,我为您编写了一个Suricata规则,用于检测png_handle_sPLT中的整数溢出漏洞。以下是规则的具体内容:

alert tcp $HOME_NET any -> $EXTERNAL_NET 80 (msg:"ET EXPLOIT Potential PNG Integer Overflow in libPNG png_handle_sPLT"; flow:established,to_server; content:"|89 50 4E 47|"; depth:4; content:"|78 9C|"; distance:0; content:"|50 4C 54 53|"; within:16; content:"|00 00|"; distance:0; reference:url,www.securityfocus.com/bid/29931; classtype:attempted-user; sid:2015618; rev:1; metadata:created_at 2012_04_10, updated_at 2019_07_26;)

规则解释:

  1. 流量方向alert tcp $HOME_NET any -> $EXTERNAL_NET 80 表示我们正在监控从内部网络到外部网络的HTTP流量(通常使用80端口)。
  2. 消息说明msg:"ET EXPLOIT Potential PNG Integer Overflow in libPNG png_handle_sPLT" 是当规则匹配时将显示的消息,帮助安全人员快速理解警报的内容。
  3. 流量状态flow:established,to_server 确保只在已建立的连接且数据流向服务器时触发规则,避免误报。
  4. PNG文件头检测content:"|89 50 4E 47|"; depth:4 检测PNG文件的魔数(PNG文件头),确保我们正在分析的确实是PNG文件。
  5. 压缩标识符检测content:"|78 9C|"; distance:0 检测PNG文件中的压缩标识符,进一步确认文件格式。
  6. sPLT标记检测content:"|50 4C 54 53|"; within:16 检测sPLT标记,这是我们要重点关注的部分,因为整数溢出可能发生在处理sPLT数据时。
  7. 零值检测content:"|00 00|"; distance:0 检测零值,这可能是整数溢出的迹象。
  8. 参考链接reference:url,www.securityfocus.com/bid/29931 提供了关于此漏洞的更多信息,以便于进一步研究。
  9. 分类类型classtype:attempted-user 将此规则归类为用户尝试攻击,有助于优先级排序。
  10. 唯一标识符sid:2015618; rev:1 为规则提供唯一的标识符,并记录版本信息。
  11. 元数据metadata:created_at 2012_04_10, updated_at 2019_07_26 提供了规则创建和更新的时间信息,有助于跟踪其历史。

通过这个规则,您可以有效地检测到png_handle_sPLT中的整数溢出漏洞,从而提高网络安全防护能力。

User: 员工反映收到一封含有附件的邮件,声称是发票。附件是一个带有宏的Excel文件。

Assistant: 员工收到的邮件可能涉及社会工程学攻击,通过伪装成合法发票来诱导用户打开恶意附件。这种攻击通常利用用户对发票的信任,通过Excel文件中的宏来执行恶意代码。需要详细分析邮件内容、附件类型和潜在风险,并提供相应的防护建议。

这封邮件很可能是一次钓鱼攻击,攻击者试图通过伪装成合法发票来诱使员工打开恶意附件。以下是详细分析及建议:

  1. 攻击手法

    • 社会工程学攻击:攻击者利用员工对发票的信任,伪装邮件来源。
    • 恶意附件:Excel文件中的宏可能包含恶意代码,用于窃取信息或安装恶意软件。
  2. 潜在风险

    • 数据泄露:如果宏被激活,可能会窃取敏感数据。
    • 系统感染:恶意代码可能导致系统被植入病毒或木马。
    • 业务中断:攻击者可能通过获取权限进一步破坏业务流程。
  3. 防护措施

    • 邮件过滤:使用邮件安全工具过滤可疑邮件,阻止含有宏的附件。
    • 员工培训:教育员工识别钓鱼邮件,避免点击不明链接或附件。
    • 禁用宏功能:在组织中禁用Excel文件中的宏功能,减少风险。
    • 定期更新:确保所有软件和操作系统保持最新版本,修复已知漏洞。
    • 多因素认证:实施多因素认证,增加账户安全性。
  4. 应急响应

    • 如果发现异常,立即报告给IT部门或安全团队。
    • 隔离受影响的设备,防止攻击扩散。
    • 分析日志,确定攻击范围和影响。

通过以上措施,可以有效降低此类攻击的风险,保护企业和个人的信息安全。

User: 介绍MITRE技术T1005

Assistant: 首先,我需要确认MITRE ATT&CK框架中的技术T1005的具体内容。根据MITRE ATT&CK的描述,T1005主要涉及攻击者通过访问本地系统文件来收集信息的行为。接下来,我将详细解释该技术的工作原理、可能的利用方式以及相关的缓解措施。

MITRE ATT&CK技术T1005(本地系统数据)描述了攻击者如何通过访问本地系统文件来获取敏感信息的行为。这种技术通常用于收集以下类型的数据:

  1. 用户凭证:包括用户名和密码等身份验证信息。
  2. 账户凭据:例如登录会话令牌或API密钥。
  3. 配置文件:可能包含数据库连接字符串或其他关键设置。
  4. 文档和报告:可能包含机密信息或商业敏感数据。

工作原理

攻击者可以通过多种方式访问这些文件:

  • 直接访问文件:例如读取存储在磁盘上的文件。
  • 使用系统工具:如catfindgrep等命令行工具。
  • 利用漏洞:通过已知的系统或应用程序漏洞获取对文件的访问权限。

潜在影响

成功利用T1005可能导致以下后果:

  • 数据泄露:敏感信息被未经授权的第三方访问。
  • 身份盗用:攻击者可能冒充合法用户进行进一步攻击。
  • 系统破坏:攻击者可能利用获取的信息进行更深入的渗透。

缓解措施

为了降低T1005的风险,可以采取以下措施:

  1. 最小化权限:限制用户和进程对敏感文件的访问权限。
  2. 加密敏感数据:确保存储在本地的敏感信息经过加密处理。
  3. 监控文件访问:使用安全工具监控异常的文件访问行为。
  4. 定期审计:检查系统中是否存在未授权的文件访问记录。

通过以上措施,可以有效减少攻击者利用T1005技术的风险。


Quickstart

The code of Qwen2.5 has been in the latest Hugging Face transformers and we advise you to use the latest version of transformers.

With transformers<4.37.0, you will encounter the following error:

KeyError: 'qwen2'

The following contains a code snippet illustrating how to use the model generate content based on given inputs.

import torch
import transformers
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "sds-ai/SecGPT-14B-Reasoning"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="cuda",
    attn_implementation='flash_attention_2'
)

prompt = "SpringBoot常见的接口路由泄露有哪些?列举Swagger相关路径"
messages = [
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# conduct text completion
generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=32768,
    temperature=0.6
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
content = tokenizer.decode(output_ids, skip_special_tokens=True)

print("content:", content)

Switching Between Thinking and Non-Thinking Mode

The enable_thinking switch is also available in APIs created by SGLang and vLLM. Please refer to our documentation for SGLang and vLLM users.

enable_thinking=True

By default, Qwen3 has thinking capabilities enabled, similar to QwQ-32B. This means the model will use its reasoning abilities to enhance the quality of generated responses. For example, when explicitly setting enable_thinking=True or leaving it as the default value in tokenizer.apply_chat_template, the model will engage its thinking mode.

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True  # True is the default value for enable_thinking
)

In this mode, the model will generate think content wrapped in a <think>...</think> block, followed by the final response.

For thinking mode, use Temperature=0.6, TopP=0.95, TopK=20, and MinP=0 (the default setting in generation_config.json). DO NOT use greedy decoding, as it can lead to performance degradation and endless repetitions. For more detailed guidance, please refer to the Best Practices section.

enable_thinking=False

We provide a hard switch to strictly disable the model's thinking behavior, aligning its functionality with the previous Qwen2.5-Instruct models. This mode is particularly useful in scenarios where disabling thinking is essential for enhancing efficiency.

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=False  # Setting enable_thinking=False disables thinking mode
)

In this mode, the model will not generate any think content and will not include a <think>...</think> block.

For non-thinking mode, we suggest using Temperature=0.7, TopP=0.8, TopK=20, and MinP=0. For more detailed guidance, please refer to the Best Practices section.

Advanced Usage: Switching Between Thinking and Non-Thinking Modes via User Input

We provide a soft switch mechanism that allows users to dynamically control the model's behavior when enable_thinking=True. Specifically, you can add /think and /no_think to user prompts or system messages to switch the model's thinking mode from turn to turn. The model will follow the most recent instruction in multi-turn conversations.

Downloads last month
28
Safetensors
Model size
14.8B params
Tensor type
FP16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for sds-ai/SecGPT-14B-Reasoning

Base model

Qwen/Qwen2.5-14B
Finetuned
(185)
this model
Quantizations
2 models