AnalysisType: rule
Filename: github_repo_hook_modified.py
RuleID: "GitHub.Repo.HookModified"
DisplayName: "DEPRECATED - GitHub Web Hook Modified"
Status: Deprecated
Enabled: false
LogTypes:
- GitHub.Audit
Tags:
- GitHub
- Exfiltration:Automated Exfiltration
- Deprecated
Reports:
MITRE ATT&CK:
- TA0010:T1020
Reference: https://docs.github.com/en/webhooks/about-webhooks
Severity: Info
Description: Deprecated. See GitHub.Webhook.Modified instead.
Tests:
- Name: GitHub - Webhook Created
ExpectedResult: true
Log:
{
"actor": "cat",
"action": "hook.create",
"data":
{
"hook_id": 111222333444555,
"events": ["fork", "public", "pull_request", "push", "repository"],
},
"org": "my-org",
"p_log_type": "GitHub.Audit",
"repository": "my-org/my-repo",
}
- Name: GitHub - Webhook Deleted
ExpectedResult: true
Log:
{
"actor": "cat",
"action": "hook.destroy",
"data":
{
"hook_id": 111222333444555,
"events": ["fork", "public", "pull_request", "push", "repository"],
},
"org": "my-org",
"p_log_type": "GitHub.Audit",
"repository": "my-org/my-repo",
}
- Name: GitHub - Non Webhook Event
ExpectedResult: false
Log:
{
"actor": "cat",
"action": "org.invite_member",
"org": "my-org",
"p_log_type": "GitHub.Audit",
"repository": "my-org/my-repo",
}
# ------ paired body: github_repo_hook_modified.py ------
def rule(event):
return event.get("action").startswith("hook.")
def title(event):
action = "modified"
if event.get("action").endswith("destroy"):
action = "deleted"
elif event.get("action").endswith("create"):
action = "created"
return f"web hook {action} in repository [{event.get('repo','<UNKNOWN_REPO>')}]"
def severity(event):
if event.get("action").endswith("create"):
return "MEDIUM"
return "INFO"