Communitygithub.com

bg-szy/TOP-SKILLS

Trail of Bits의 커버리지 기반 Ruby 퍼저인 Ruzzy를 설정하고 실행합니다. 하네스 구조, 순수 Ruby 및 gem의 네이티브 C 확장 퍼징, 샌나타이저 빌드를 다룹니다. Ruby 라이브러리나 gem을 퍼징하거나, Ruby C 확장의 메모리 안전성을 테스트하거나, Ruby를 어떻게 퍼징해야 할지 물어볼 때 사용하세요.

TOP-SKILLS란 무엇인가요?

이 스킬은 Ruby 언어를 위한 유일한 프로덕션 준비 커버리지 기반 퍼저인 Ruzzy를 설정하고 실행하는 방법을 제공합니다. Ruzzy는 libFuzzer를 기반으로 구축되어 순수 Ruby 코드와 Ruby C 확장을 모두 퍼징할 수 있으며, AddressSanitizer(ASan) 및 UndefinedBehaviorSanitizer(UBSan)를 통합하여 메모리 손상 및 정의되지 않은 동작을 탐지합니다. 이 가이드는 설치, 하네스 작성(순수 Ruby의 경우 트레이서 스크립트 필요, C 확장의 경우 단일 파일), sanitizer 플래그로 gem 컴파일, 캠페인 실행 및 충돌 재현을 다룹니다. Linux x86-64 및 AArch64/ARM64를 지원하며, macOS나 Windows에서는 Docker를 사용해야 합니다. 사용자는 `LD_PRELOAD`를 통한 sanitizer 주입, `ASAN_OPTIONS` 설정, libFuzzer 옵션 전달 방법을 배울 수 있습니다. 스킬에는 msgpack-ruby와 같은 실제 예제와 문제 해결 팁이 포함되어 있어 Ruby 코드베이스의 보안 취약점 발견에 유용합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/bg-szy/TOP-SKILLS/tree/HEAD/skills/skills/ruzzy

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Ruzzy

Ruzzy는 libFuzzer를 기반으로 구축된 Ruby용 커버리지 기반 퍼저입니다. 순수 Ruby 코드와 Ruby C 확장을 모두 퍼징할 수 있으며, 메모리 손상 및 정의되지 않은 동작을 탐지하는 샌나타이저를 지원합니다.

사용 시기

Ruzzy는 현재 Ruby용 유일한 프로덕션 준비 커버리지 기반 퍼저입니다.

다음과 같은 경우 Ruzzy를 선택하세요:

  • Ruby 애플리케이션이나 라이브러리 퍼징
  • Ruby C 확장의 메모리 안전성 문제 테스트
  • Ruby 코드에 커버리지 기반 퍼징이 필요할 때
  • 네이티브 확장이 있는 Ruby gem 작업

빠른 시작

환경 설정:

export ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0"

포함된 예제로 테스트:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby -e 'require "ruzzy"; Ruzzy.dummy'

이 명령은 빠르게 크래시를 찾아 Ruzzy가 제대로 작동하는지 보여줍니다.

설치

플랫폼 지원

Ruzzy는 Linux x86-64 및 AArch64/ARM64를 지원합니다. macOS나 Windows의 경우 Dockerfile 또는 개발 환경을 사용하세요.

사전 요구 사항

  • Linux x86-64 또는 AArch64/ARM64
  • 최신 버전의 clang (14.0.0까지 테스트됨, 최신 릴리스 권장)
  • gem이 설치된 Ruby

설치 명령어

clang 컴파일러 플래그와 함께 Ruzzy 설치:

MAKE="make --environment-overrides V=1" \
CC="/path/to/clang" \
CXX="/path/to/clang++" \
LDSHARED="/path/to/clang -shared" \
LDSHAREDXX="/path/to/clang++ -shared" \
    gem install ruzzy

환경 변수 설명:

  • MAKE: 이후 환경 변수를 적용할 수 있도록 make를 재정의
  • CC, CXX, LDSHARED, LDSHAREDXX: 최신 기능을 위해 적절한 clang 바이너리 사용

설치 문제 해결

설치가 실패하면 디버그 출력 활성화:

RUZZY_DEBUG=1 gem install --verbose ruzzy

설치 확인

빠른 시작 섹션의 예제를 실행하여 설치 확인.

하네스 작성

순수 Ruby 코드 퍼징

순수 Ruby 퍼징은 Ruby 인터프리터 구현 세부 사항으로 인해 두 개의 스크립트가 필요합니다.

트레이서 스크립트 (test_tracer.rb):

# frozen_string_literal: true

require 'ruzzy'

Ruzzy.trace('test_harness.rb')

하네스 스크립트 (test_harness.rb):

# frozen_string_literal: true

require 'ruzzy'

def fuzzing_target(input)
  # 퍼징할 코드를 여기에 작성
  if input.length == 4
    if input[0] == 'F'
      if input[1] == 'U'
        if input[2] == 'Z'
          if input[3] == 'Z'
            raise
          end
        end
      end
    end
  end
end

test_one_input = lambda do |data|
  fuzzing_target(data)
  return 0
end

Ruzzy.fuzz(test_one_input)

실행:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby test_tracer.rb

Ruby C 확장 퍼징

C 확장은 단일 하네스 파일로 퍼징할 수 있으며, 트레이서가 필요하지 않습니다.

msgpack용 하네스 예제 (fuzz_msgpack.rb):

# frozen_string_literal: true

require 'msgpack'
require 'ruzzy'

test_one_input = lambda do |data|
  begin
    MessagePack.unpack(data)
  rescue Exception
    # 메모리 손상을 찾고 있으므로 Ruby 예외는 무시
  end
  return 0
end

Ruzzy.fuzz(test_one_input)

실행:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby fuzz_msgpack.rb

하네스 규칙

해야 할 것하지 말아야 할 것
C 확장 테스트 시 Ruby 예외를 잡을 것Ruby 예외로 퍼저가 크래시나게 두지 말 것
test_one_input 람다에서 0을 반환할 것다른 값을 반환하지 말 것
하네스를 결정론적으로 유지할 것무작위성이나 시간 기반 로직을 사용하지 말 것
순수 Ruby의 경우 트레이서 스크립트를 사용할 것순수 Ruby 코드에서 트레이서를 건너뛰지 말 것

참고: 자세한 하네스 작성 기법, 복잡한 입력 처리 패턴 및 고급 전략은 fuzz-harness-writing 기술 스킬을 참조하세요.

컴파일

샌나타이저와 함께 gem 설치

퍼징용 C 확장이 포함된 Ruby gem을 설치할 때는 샌나타이저 플래그로 컴파일합니다:

MAKE="make --environment-overrides V=1" \
CC="/path/to/clang" \
CXX="/path/to/clang++" \
LDSHARED="/path/to/clang -shared" \
LDSHAREDXX="/path/to/clang++ -shared" \
CFLAGS="-fsanitize=address,fuzzer-no-link -fno-omit-frame-pointer -fno-common -fPIC -g" \
CXXFLAGS="-fsanitize=address,fuzzer-no-link -fno-omit-frame-pointer -fno-common -fPIC -g" \
    gem install <gem-name>

빌드 플래그

플래그목적
-fsanitize=address,fuzzer-no-linkAddressSanitizer 및 퍼저 계측 활성화
-fno-omit-frame-pointer스택 트레이스 품질 향상
-fno-common샌나타이저와의 더 나은 호환성
-fPIC공유 라이브러리를 위한 위치 독립 코드
-g디버그 심볼 포함

캠페인 실행

환경 설정

퍼징 캠페인을 실행하기 전에 ASAN_OPTIONS를 설정하세요:

export ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0"

옵션 설명:

  1. allocator_may_return_null=1: 일반적인 영향이 적은 할당 실패(DoS) 건너뛰기
  2. detect_leaks=0: Ruby 인터프리터가 데이터를 누수하므로 일단 무시
  3. use_sigaltstack=0: Ruby는 ASan과 함께 sigaltstack을 비활성화할 것을 권장

기본 실행

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb

참고: LD_PRELOAD는 샌나타이저 주입에 필요합니다. ASAN_OPTIONS와 달리 내보내지 마세요. 다른 프로그램과 간섭할 수 있습니다.

말뭉치와 함께

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb /path/to/corpus

libFuzzer 옵션 전달

모든 libFuzzer 옵션을 인수로 전달할 수 있습니다:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb /path/to/corpus -max_len=1024 -timeout=10

전체 참조는 libFuzzer 옵션을 참조하세요.

크래시 재현

크래시 파일을 전달하여 재실행:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb ./crash-253420c1158bc6382093d409ce2e9cff5806e980

출력 해석

출력의미
INFO: Running with entropic power schedule퍼징 캠페인 시작됨
ERROR: AddressSanitizer: heap-use-after-free메모리 손상 감지됨
SUMMARY: libFuzzer: fuzz target exitedRuby 예외 발생
artifact_prefix='./'; Test unit written to ./crash-*크래시 입력 저장됨
Base64: ...크래시 입력의 Base64 인코딩

샌나타이저 통합

AddressSanitizer (ASan)

Ruzzy에는 미리 컴파일된 AddressSanitizer 라이브러리가 포함되어 있습니다:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb

다음 탐지에 ASan 사용:

  • 힙 버퍼 오버플로
  • 스택 버퍼 오버플로
  • 사용 후 해제
  • 이중 해제
  • 메모리 누수(Ruzzy에서 기본적으로 비활성화)

UndefinedBehaviorSanitizer (UBSan)

Ruzzy에는 UBSan도 포함되어 있습니다:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::UBSAN_PATH') \
    ruby harness.rb

다음 탐지에 UBSan 사용:

  • 부호 있는 정수 오버플로
  • 널 포인터 역참조
  • 정렬되지 않은 메모리 접근
  • 0으로 나누기

일반적인 샌나타이저 문제

문제해결책
Ruby 인터프리터 누수 경고ASAN_OPTIONS=detect_leaks=0 사용
Sigaltstack 충돌ASAN_OPTIONS=use_sigaltstack=0 사용
할당 실패 스팸ASAN_OPTIONS=allocator_may_return_null=1 사용
LD_PRELOAD가 도구와 간섭내보내지 말고 ruby 명령과 함께 인라인으로 설정

참고: 자세한 샌나타이저 구성, 일반적인 문제 및 고급 플래그는 address-sanitizer 및 undefined-behavior-sanitizer 기술 스킬을 참조하세요.

실제 예제

예제: msgpack-ruby

msgpack MessagePack 파서의 메모리 손상 퍼징.

샌나타이저로 설치:

MAKE="make --environment-overrides V=1" \
CC="/path/to/clang" \
CXX="/path/to/clang++" \
LDSHARED="/path/to/clang -shared" \
LDSHAREDXX="/path/to/clang++ -shared" \
CFLAGS="-fsanitize=address,fuzzer-no-link -fno-omit-frame-pointer -fno-common -fPIC -g" \
CXXFLAGS="-fsanitize=address,fuzzer-no-link -fno-omit-frame-pointer -fno-common -fPIC -g" \
    gem install msgpack

하네스 (fuzz_msgpack.rb):

# frozen_string_literal: true

require 'msgpack'
require 'ruzzy'

test_one_input = lambda do |data|
  begin
    MessagePack.unpack(data)
  rescue Exception
    # 메모리 손상을 찾고 있으므로 Ruby 예외는 무시
  end
  return 0
end

Ruzzy.fuzz(test_one_input)

실행:

export ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0"
LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby fuzz_msgpack.rb

예제: 순수 Ruby 대상

커스텀 파서로 순수 Ruby 코드 퍼징.

트레이서 (test_tracer.rb):

# frozen_string_literal: true

require 'ruzzy'

Ruzzy.trace('test_harness.rb')

하네스 (test_harness.rb):

# frozen_string_literal: true

require 'ruzzy'
require_relative 'my_parser'

test_one_input = lambda do |data|
  begin
    MyParser.parse(data)
  rescue StandardError
    # 잘못된 입력으로 인한 예상 예외
  end
  return 0
end

Ruzzy.fuzz(test_one_input)

실행:

export ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0"
LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby test_tracer.rb

문제 해결

문제원인해결책
설치 실패잘못된 clang 버전 또는 경로clang 경로 확인, clang 14.0.0+ 사용
cannot open shared object fileLD_PRELOAD가 설정되지 않음ruby 명령과 인라인으로 LD_PRELOAD 설정
퍼저가 즉시 종료됨말뭉치 디렉터리 없음말뭉치 디렉터리를 생성하거나 인수로 전달
커버리지 진행 없음순수 Ruby는 트레이서 필요순수 Ruby 코드에는 트레이서 스크립트 사용
누수 탐지 스팸Ruby 인터프리터 누수ASAN_OPTIONS=detect_leaks=0 설정
설치 디버그 필요컴파일 오류RUZZY_DEBUG=1 gem install --verbose ruzzy 사용

관련 스킬

기술 스킬

스킬사용 사례
fuzz-harness-writing효과적인 하네스 작성에 대한 자세한 안내
address-sanitizer퍼징 중 메모리 오류 탐지
undefined-behavior-sanitizerC 확장에서 정의되지 않은 동작 탐지
libfuzzerlibFuzzer 옵션 이해(Ruzzy는 libFuzzer 기반)

관련 퍼저

스킬고려 시기
libfuzzerRuby C 확장 코드를 C/C++에서 직접 퍼징할 때
aflppRuby 인터프리터를 계측하여 Ruby를 퍼징하는 대체 접근 방식

리소스

주요 외부 리소스

Ruzzy 소개: 커버리지 기반 Ruby 퍼저 Ruzzy를 발표하는 공식 Trail of Bits 블로그 게시물. 동기, 아키텍처 및 초기 결과 포함.

Ruzzy GitHub 저장소 소스 코드, 추가 예제 및 개발 지침.

libFuzzer 문서 Ruzzy는 libFuzzer를 기반으로 구축되므로 libFuzzer 옵션과 동작을 이해하는 것이 중요합니다.

Ruby C 확장 퍼징 컴파일 플래그와 예제를 포함한 C 확장 퍼징에 대한 자세한 가이드.

순수 Ruby 코드 퍼징 순수 Ruby 퍼징에 필요한 트레이서 패턴에 대한 자세한 가이드.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

bg-szy/TOP-SKILLS

Brand-first landing page designer — runs a brand-identity interview (colors, typography, shape language), then generates and iterates on a polished landing page via Stitch with deployment-ready HTML. Use when the user asks to create, design, or build a landing page, homepage, or marketing page and has no established visual direction. Skip when they have a design mockup, need a dashboard or app UI, are working at component level, building a multi-page app, or restyling with known design tokens — use frontend-design instead.

bg-szy/TOP-SKILLS

Fill out Microsoft Azure Landing Zone (ALZ) Accelerator checklists by interviewing the user, mapping their Azure subscriptions, integrating IP addressing documentation, and applying Microsoft Cloud Adoption Framework best practices. Produces a completed Excel checklist (.xlsx) ready for ALZ deployment. Use this skill whenever the user mentions Azure Landing Zone, ALZ checklist, landing zone accelerator, platform landing zone configuration, ALZ bootstrap, hub-and-spoke setup, Azure network topology planning, or wants to fill out any ALZ-related checklist or configuration file. Also trigger when the user uploads an Excel file that contains tabs like "Accelerator - Bootstrap", "Accelerator - Bicep", or "Accelerator - Terraform".

bg-szy/TOP-SKILLS

Compose a premium, animated landing page section by section in Next.js + Tailwind + Motion (Framer Motion) — built on a real design system, with editorial copy and motion that feels human-crafted, not template-generated. Use when building or rebuilding a landing page, marketing site, or hero/feature/pricing/CTA sections that need to look production-ready and bespoke from day one.

bg-szy/TOP-SKILLS

Write high-converting landing page copy using proven frameworks like PAS (Problem-Agitate-Solution), AIDA, and StoryBrand. Creates headlines, value propositions, CTAs, and full page sections optimized for conversion. Use when users need landing page copy, sales page content, or marketing website text.

bg-szy/TOP-SKILLS

Optimize landing pages for conversions, performance, and SEO. Use when improving landing pages, increasing conversions, or optimizing page performance.

bg-szy/TOP-SKILLS

Review investment portfolios for risk, diversification, fees. Asset allocation recommendations, tax-loss harvesting, rebalancing.

bg-szy/TOP-SKILLS

Beads Viewer - Graph-aware triage engine for Beads projects. Computes PageRank, betweenness, critical path, and cycles. Use --robot-* flags for AI agents.

bg-szy/TOP-SKILLS

CI red? Call us. Pipeline fire brigade deploys. Use when user mentions CI failures, build errors, test failures, or pipeline issues. Do NOT load for: local builds, standard implementation work, reviews, or setup.

bg-szy/TOP-SKILLS

CASS Memory System - procedural memory for AI coding agents. Three-layer cognitive architecture with confidence decay, anti-pattern learning, cross-agent knowledge transfer, trauma guard safety system. Bun/TypeScript CLI.

bg-szy/TOP-SKILLS

Mandatory entry point: read this first for any request to make, create, edit, animate, or render a video, animation, or motion graphic, including a promo, explainer, captioned clip, title card, overlay, slideshow or interactive deck, Remotion port, or any HyperFrames HTML composition. Also use it to inspect, diagnose, validate, preview, publish, or batch-render an existing HyperFrames project. Inputs may be a website URL, GitHub PR, Figma design or URL, text or brief, existing footage, or music. It resumes project state, captures intent when applicable, selects and installs the owning workflow, and routes domain capabilities. HyperFrames is the default output framework unless the user explicitly chooses another framework for the deliverable or asks only to record a browser session.

bg-szy/TOP-SKILLS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

bg-szy/TOP-SKILLS

Use when the user asks to "pre-launch check the landing page", "run a Quality-Score preflight", or "verify ad-to-page message match before launch"; produces an ad↔page continuity report — message-match gaps, above-the-fold check, page-speed read, form-friction count, mobile-render flags — as a pass/fix punch list. Not for redesigning or rewriting the page — use landing-optimizer; not for scoring the account or the RQS — use ad-account-auditor. 落地页体验预检/广告落地页一致性检查

bg-szy/TOP-SKILLS

Use when the user asks to "optimize our landing page for influencer traffic", "fix our promo-code landing page", or "improve conversion from a creator campaign"; produces a message-match audit, page-structure and social-proof recommendations, a promo-code/CTA conversion plan, and an A/B test roadmap. Not for measuring campaign results after launch — use performance-analyzer.

bg-szy/TOP-SKILLS

Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review, critique or improve a landing page, sales page, opt-in page, product page or checkout flow, when conversion rate is low, when paid traffic is not converting, or when someone asks "why isn't this page converting" or wants a CRO / landing page review.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Account assets, equity and fund positions, P&L, cash flow records, account statements, margin ratios, buy-power estimates, order management, and DCA recurring investments via Longbridge (most require Trade permission). Frameworks: portfolio diagnosis, rebalancing, asset allocation, risk analysis (VaR/CVaR), performance attribution, and tax-loss harvesting. Triggers: "持仓", "账户", "盈亏", "资产", "对账单", "下单", "买入", "卖出", "撤单", "定投", "组合诊断", "再平衡", "资产配置", "风险分析", "绩效归因", "税损收割", "持倉", "賬戶", "盈虧", "對賬單", "下單", "買入", "賣出", "組合診斷", "再平衡", "稅損收割", "positions", "portfolio", "P&L", "order", "buy", "sell", "DCA", "statement", "risk analysis", "rebalancing", "tax harvesting", "我的风险", "持仓风险", "风险敞口", "資產", "資產配置", "風險分析", "績效歸因", "撤單

bg-szy/TOP-SKILLS

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

bg-szy/TOP-SKILLS

Process video files with audio extraction, format conversion (mp4, webm), and Whisper transcription. Use when user mentions video conversion, audio extraction, transcription, mp4, webm, ffmpeg, or whisper transcription.

관련 스킬