business-logic-race

Invoke when the target includes business functions such as payments, ordering, refunds, withdrawals, transfers, coupons, points, red packets, memberships, subscriptions, approvals, inventory, lotteries, or when state transitions, controllable amount parameters, or replayable concurrency are observed. Responsible for modeling business state machines and deeply probing amount tampering, order state jumps, race conditions, and replay attacks.

Last repository push
GitHub Stars
169
Forks
29
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "business-logic-race" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c2c40dca42538c7df9a121ea90d1327fce4285a6fd25cd0b5996f67e29c31b30. Verify the upstream source and version against https://github.com/zhaji2333/CkSKILLS before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Invoke when the target includes business functions such as payments, ordering, refunds, withdrawals, transfers, coupons, points, red packets, memberships, subscriptions, approvals, inventory, lotteries, or when state transitions, controllable amount parameters, or replayable concurrency are observed. Responsible for modeling business state machines and deeply probing amount tampering, order state jumps, race conditions, and replay attacks.

0 Downloads

Introduction source: third_party · zhaji2333 · 0.0.1 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: business-logic-race
description: 当目标存在支付/下单/退款/提现/转账/优惠券/积分/红包/会员/订阅/审批/库存/抽奖等业务功能,或发现状态可跳变、金额参数可控、并发可重放时调用。负责业务状态机建模、金额篡改、订单状态跳变、竞态条件与重放攻击深度挖掘。

business-logic-race — 业务逻辑与并发竞态专项深度挖掘

何时调用(触发条件)

  • 支付流程:下单→支付→回调→发货→退款→提现
  • 资金相关:金额、数量、折扣、优惠券、积分、余额、红包
  • 状态流转:订单状态、审批状态、权益状态可被篡改/跳过
  • 并发场景:库存扣减、优惠券领取、提现、转账、兑换
  • 业务复杂:状态机不清晰、一致性校验位置不明

一、业务逻辑建模(先理解再测试)

原则:不理解业务就不可能发现业务逻辑漏洞。

测试任何功能前,必须先回答:

  1. 这个功能的完整状态机是什么?(所有状态+所有转换条件)
  2. 每个状态转换谁有权执行?(角色矩阵)
  3. 哪些转换不应该被允许?(非法路径)
  4. 数据在各环节的一致性校验在哪里做的?(前端/后端/数据库)
  5. 并发场景下会不会出问题?(竞态条件)

重点建模场景:

  • 支付流程:下单→支付→回调→发货→退款→提现(每个箭头都是攻击点)
  • 认证流程:注册→登录→找回密码→绑定→解绑(每个步骤的凭证传递)
  • 权限模型:角色→权限→资源(每个绑定关系是否可篡改)
  • 审批流程:提交→审核→通过/驳回(能否跳过/重放/篡改状态)

二、支付/资金类场景表(全景)

场景 漏洞类型 挖掘要点
商品下单 金额篡改/数量篡改 价格参数可控、负数/0元/小数精度
优惠券/积分/红包 无限领取/超额使用/叠加 并发领取、ID遍历、多券叠加
支付回调 签名绕过/金额不一致 回调验签缺失、金额未二次校验
退款流程 重复退款/超额退款 并发退款、退款金额可控
提现/转账 越权提现/金额篡改 提现账户可控、余额校验绕过
会员/订阅 越权开通/无限试用 会员等级可控、试用次数绕过
虚拟货币/积分 积分盗刷/负数充值 并发兑换、金额类型混淆
分销/返佣 自推自/刷单 邀请关系可控、返佣逻辑缺陷

三、业务逻辑漏洞攻击套路

支付类:
  - 金额参数篡改(0.01、负数、小数精度)
  - 优惠券/积分/余额叠加
  - 订单状态跳变(未支付→已支付)
  - 并发重放(多次到账)
  - 退款不扣库存

权益类:
  - 无限领取/次数限制绕过
  - 试用→正式状态跳过
  - 会员等级参数可控

流程类:
  - 跳步(绕过前置节点)
  - 重放(同一步骤多次执行)
  - 状态回退/覆盖

四、并发与竞态专项

常见竞态场景

  • 库存扣减:并发下单是否超卖
  • 优惠券领取:并发领取是否多发
  • 提现/转账:并发操作余额是否被重复扣
  • 兑换:积分并发兑换是否重复到账
  • 退款:并发退款是否超额

测试方法

  • 同一请求并发发送(xargs -P / Burp Turbo Intruder / 脚本线程池)
  • 在关键操作(支付回调、发货、领券)同时重放请求
  • 观察数据库/业务结果的最终一致性

修复方向

  • 幂等键:请求唯一标识,重复请求直接返回
  • 数据库约束:唯一索引、余额非负约束、乐观锁
  • 分布式锁 / 事务隔离
  • 服务端二次校验:回调金额与订单金额比对,状态校验原子化

五、验证要点

  • 每个状态转换测试:正常路径、跳过、回退、重放、并发
  • 数据一致性校验位置:前端传参 vs 服务端计算
  • 金额/数量:负数、0、小数精度、类型替换(字符串/数组)
  • 支付回调:验签缺失、金额未二次校验、notify_url 可控
  • 并发结果必须有证据:多次成功响应/数据库记录差异

六、修复建议

  • 金额/价格以服务端为准,禁止信任前端传参
  • 状态转换服务端校验合法性(状态机表驱动)
  • 幂等、唯一约束、分布式锁
  • 回调验签 + 金额二次校验 + 回调防重放

Version history

  1. v2.1.0 GitHub ↗
    Original release notes

    ## 一句话 新增 **`kb/` 结构化数据层**(664 CVE / 237 字典 / 69 载荷)与 **内网/域技能包 `internal-network`**(10 块),`cloud-infra` 扩充 10 块;全局路由、纪律、索引同步接线,并修掉 7 个超限知识块与存量死链。 ## 新增 - **数据层 `kb/`**:`vuln/` 664 条 CVE(ai/cloud/middleware/network/web)、`dict/` 237 个字典(368 万行)、`payload/` 69 个载荷;4 个自动索引 + `tools/kb_index.py`(`--check` 做一致性闸,不参与默认加载) - **`internal-network`(内网/域)**:域侦察与决策树、Kerberos、委派/ACL/ADCS、凭据/中继/投毒、横向移动、隧道多跳、后渗透提权、持久化、内网基础设施(Exchange/SCCM/OA/DB/中间件)、工具投递 - **`kb-security-data`**:CVE / 字典 / payload 检索入口(30 秒分诊 + 证据纪律) - **`cloud-infra` +10 块**:多云概览、AWS IAM 提权、Azure/GCP、国内云、云凭据/IAM/元数据、K8s 逃逸与集群、K8s 组件/网络/存储、容器运行时、对象存储/Serverless、CI-CD/供应链/IaC - **战法索引-08-内网与域**(22 行首枪表)、`rules/55-kb-usage.md`、`templates/SEEDS.template.md` - **`docs/CHANGELOG.md`**:v2.1 完整更新记录 ## 变更 - `AGENTS.md`(10 秒决策 + 文件地图)、`rules/70`、`docs/TRIGGER-MATRIX.md`、`ck-router`(分诊/索引/进站决策)、`README.md`、`docs/ARCHITECTURE.md`(六层结构)全部接线 - 技能包 16 → **18**,知识块 **501**,规则 11 → **12** ## 修复 - 7 个超过 12KB 的知识块按「索引 + 分段」拆分(原文件名保留,新增 `-b` 分段) - 存量死链、kb 相对路径、索引兜底计数、CTF 导向表述清理 ## 验收 - 单块 ≤12KB:0 超限;SKILL.md 全部达标;死链 0 - `python3 tools/kb_index.py --check` → OK(664 / 237 / 69) - 常驻层 `AGENTS.md` 5.4KB(限 6.5KB) ## 升级方式 更新仓库后运行 `python3 tools/kb_index.py --check` 确认索引一致;用法见 `docs/CHANGELOG.md` 第 5 节与 `README.md`「数据层 kb/」小节。

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 覆盖支付、资金、订单、并发等高频业务场景的安全测试
  • 提供全景攻击套路与修复建议,实用性强
Trigger Precision90/100

Highlights

  • 触发词覆盖全面,边界清晰,涵盖多种业务功能与漏洞类型
Structure and Standards95/100

Highlights

  • 结构清晰,分章节完整,含表格与代码示例,frontmatter规范
Execution Reliability90/100

Highlights

  • 工具来源明确,参数说明清晰,覆盖主要异常场景
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.