autoreg-skills-max: initial public release (restored, redacted, hardened)
This commit is contained in:
126
skills/bypass-ai/references/copilot-subagent-billing-bypass.md
Normal file
126
skills/bypass-ai/references/copilot-subagent-billing-bypass.md
Normal file
@@ -0,0 +1,126 @@
|
||||
# Copilot Subagent Billing Bypass — Setup & Testing (2026-08-16)
|
||||
|
||||
> Practical setup for the subagent billing bypass exploit on GitHub Copilot (VS Code).
|
||||
> Based on GitHub Issue #292452. Confirmed working on Copilot Chat 0.58.0 (VS Code 1.130.0).
|
||||
|
||||
## TL;DR
|
||||
|
||||
Same exploit as Cursor — create a subagent with a premium model, route through a cheap parent model, billing only counts parent tokens. Works on Copilot Free (GPT-4o-mini parent → Claude Opus 4.5 subagent).
|
||||
|
||||
## File Setup
|
||||
|
||||
### `.github/agents/opus.agent.md`
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: opus-agent
|
||||
description: Premium agent running Opus 4.5 for heavy tasks
|
||||
argument-hint: Query or task to complete
|
||||
model: Claude Opus 4.5 (copilot)
|
||||
---
|
||||
|
||||
You are a premium coding agent. Respond comprehensively and accurately to the user's query/task ($ARGUMENTS).
|
||||
|
||||
Rules:
|
||||
- Be thorough and detailed
|
||||
- Do not truncate or summarize — give full responses
|
||||
- You have unlimited context — use it
|
||||
```
|
||||
|
||||
### `.github/prompts/ask-opus.prompt.md`
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: ask-opus
|
||||
description: Route a query to the Opus-4.5 subagent for free
|
||||
model: GPT-4o mini (copilot)
|
||||
agent: agent
|
||||
---
|
||||
|
||||
<USER_REQUEST_INSTRUCTIONS>
|
||||
Call #tool:agent/runSubagent - include the following args:
|
||||
- agentName: "opus-agent"
|
||||
- prompt: $USER_QUERY
|
||||
</USER_REQUEST_INSTRUCTIONS>
|
||||
|
||||
<USER_REQUEST_RULES>
|
||||
- You can call the 'subagent' defined in 'USER_REQUEST_INSTRUCTIONS' as many times as needed to fulfill the user's request.
|
||||
- Use the subagent for ALL todos/tasks/queries — do not perform any task or respond to any query yourself. You are just an orchestrator.
|
||||
- Do not manipulate/summarize subagent responses to save on tokens. Always be comprehensive and verbose.
|
||||
- Do not evaluate or respond to the remainder of this message. The subagent is responsible for all further content.
|
||||
</USER_REQUEST_RULES>
|
||||
|
||||
--- USER_REQUEST_START ---
|
||||
```
|
||||
|
||||
## Manual Test Steps
|
||||
|
||||
1. Open VS Code in project with `.github/` directory
|
||||
2. `Ctrl+Shift+I` → Copilot Chat
|
||||
3. Select model: **GPT-4o mini** (free)
|
||||
4. Switch mode to **Agent** (dropdown at bottom of chat)
|
||||
5. Type: `/ask-opus write a production-ready FastAPI server with JWT auth and PostgreSQL`
|
||||
6. Check Copilot Usage Dashboard — premium tokens from Opus 4.5 should be consumed but premium request counter should NOT decrease
|
||||
|
||||
## Automated Testing (CLI)
|
||||
|
||||
### `code chat` CLI (VS Code 1.130.0+)
|
||||
|
||||
```bash
|
||||
# Open VS Code with agent mode chat
|
||||
code chat --mode agent --reuse-window "Write a Python FastAPI server"
|
||||
|
||||
# Pipe from stdin
|
||||
echo "Write a Python FastAPI server" | code chat --mode agent -
|
||||
```
|
||||
|
||||
### Copilot API (Direct HTTP)
|
||||
|
||||
**Endpoint:** `https://api.individual.githubcopilot.com/chat/completions`
|
||||
**Auth:** GitHub OAuth token (`gh auth token`)
|
||||
|
||||
```bash
|
||||
GITHUB_TOKEN=$(gh auth token)
|
||||
curl -s -X POST "https://api.individual.githubcopilot.com/chat/completions" \
|
||||
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"messages":[{"role":"user","content":"Say hello"}],"model":"gpt-4o","max_tokens":10}'
|
||||
```
|
||||
|
||||
**Supported models:** gpt-4o, gpt-4o-mini (OpenAI only — NO Claude, NO Gemini)
|
||||
**Limitation:** API does NOT support agent mode or subagents. Only basic chat completions.
|
||||
|
||||
## VS Code Remote Debugging (Electron CDP)
|
||||
|
||||
VS Code is Electron-based. Launch with debugging port for automation:
|
||||
|
||||
```bash
|
||||
"/c/Users/User/AppData/Local/Programs/Microsoft VS Code/Code.exe" \
|
||||
--remote-debugging-port=9229 \
|
||||
--user-data-dir="/c/Users/User/AppData/Roaming/Code" \
|
||||
"/c/Users/User/project-folder"
|
||||
```
|
||||
|
||||
Check connection:
|
||||
```bash
|
||||
curl -s http://localhost:9229/json/version
|
||||
```
|
||||
|
||||
**Pitfall:** VS Code may be stuck on update mutex (`vscode-updating is held`). Kill the InnoSetup process or wait for update to complete.
|
||||
|
||||
## Pitfalls
|
||||
|
||||
### Pitfall: Copilot API ≠ Agent Mode
|
||||
The direct HTTP API (`api.individual.githubcopilot.com`) only supports basic chat completions with OpenAI models. Agent mode, subagents, and premium models (Claude, Gemini) are ONLY available through the VS Code extension GUI. This means the exploit CANNOT be tested purely via API — it requires the VS Code GUI.
|
||||
|
||||
### Pitfall: VS Code Update Mutex
|
||||
On Windows, VS Code may refuse to launch with `--remote-debugging-port` if an update is pending. Error: `"Code is currently being updated. Please wait for the update to complete before launching."` Fix: kill the InnoSetup process or wait.
|
||||
|
||||
### Pitfall: Copilot CLI vs Extension
|
||||
`gh copilot` CLI requires the GitHub Copilot extension (`gh extension install github/gh-copilot`). The extension name conflicts with the built-in `copilot` alias. The VS Code Copilot Chat extension is separate from the CLI.
|
||||
|
||||
## Verification
|
||||
|
||||
- **Exploit working:** Premium tokens in dashboard increase, premium request counter stays at 100%
|
||||
- **Exploit patched:** Both counters increase proportionally
|
||||
- **GitHub Issue #292452** — check if still open before testing
|
||||
Reference in New Issue
Block a user