Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
lightweight_static_analysis — 오픈 소스 도구와 약간의 코드만으로 유용하고 가벼운 정적 분석을 만드세요. | Kitploit
도구/GitHubGitHub/nccgroup/lightweight_static_analysis
Static Code Analysis (SAST)Vulnerability AnalysisCode AnalysisScripting & AutomationWeb SecurityPenetration TestingLearning & Education
GitHubnccgroup/lightweight_static_analysis

lightweight_static_analysis

오픈 소스 도구와 약간의 코드만으로 유용하고 가벼운 정적 분석을 만드세요.

저장소 보기
1346년 전아직 검토되지 않음

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

경량 정적 분석

이 저장소는 ShellCon 2019 발표인 "직접 만들기: 커스텀 경량 정적 분석 도구 작성 방법"(슬라이드)의 PoC 코드를 포함합니다.

간단히 말해, 이 저장소는 오픈 소스 도구와 약간의 커스텀 코드를 사용하여 흥미로운 정적 분석을 구축하는 방법에 대한 몇 가지 구체적인 예를 보여줍니다.

이 저장소의 코드 예제:

  1. Rails 코드베이스를 반복적으로 탐색하여 정의된 컨트롤러와 사용되는 before_action들을 파악합니다.
  2. NodeJS 앱에서 명령 주입을 찾습니다.

예제 동작 방식

높은 수준에서 예제 구현은 다음과 같이 동작합니다:

  1. 분석하려는 소스 코드를 찾습니다.
  2. GitHub의 semantic 도구를 사용하여 소스 코드를 Abstract Syntax Tree(AST)로 파싱하고 JSON으로 출력합니다.
  3. JSON 형태의 AST를 Python 코드로 파싱한 다음 흥미로운 분석을 수행합니다.

설정

이 프로젝트는 Docker를 사용하여 실행하도록 만들어졌습니다.

그렇게 하려면 먼저 몇 가지를 설정해야 합니다.

우리의 Dockerfile은 GitHub 패키지 레지스트리에 호스팅된 semantic Docker 이미지를 기반으로 하므로, GitHub Package Registry와 함께 Docker를 사용하도록 구성해야 합니다.

  1. 위 문서에서 설명하는 권한으로 개인 액세스 토큰을 생성합니다.
  2. GitHub 패키지 레지스트리에 인증합니다: $ docker login docker.pkg.github.com -u USERNAME -p TOKEN
  3. Docker 컨테이너를 빌드합니다: docker build -t lightweight_static_analysis .
  4. Docker 컨테이너 내에서 bash 셸을 실행한 다음 스크립트를 실행합니다.
root@kitploit:~
# Run this 
# (Make sure to run this from a terminal in this repo's project root)
$ docker run -it --rm --entrypoint /bin/bash -v $PWD:/lightweight_static_analysis lightweight_static_analysis

# cd into this project's source code within the 
# running container
$ cd /lightweight_static_analysis

# Run main.py with different config options, described further below

실행

Docker 컨테이너에서 bash 셸을 사용할 수 있게 되면(위의 docker run 명령 참조), 몇 가지 모드 중 하나로 main.py를 실행할 수 있습니다.

root@kitploit:~
/lightweight_static_analysis> $ python3 src/main.py <options>

옵션 없이 src/main.py를 실행하거나 main.py의 parser.add_argument 부분을 보면 사용 가능한 모든 옵션을 확인할 수 있습니다.

Rails 코드베이스 탐색

Rails 코드베이스를 대화형으로 탐색하는 데 도움이 되는 몇 가지 명령이 있습니다.

먼저 하나 이상의 Rails 저장소를 클론하여 examples/에 넣으세요. 예제 저장소가 필요하다면 rubygems.org의 소스 코드나 Open Source Rails에 등록된 저장소 중 하나를 사용할 수 있습니다.

root@kitploit:~
# Print out the class, super class, defined methods, and before actions
# for all controllers
$ python3 src/main.py --rails-summarize-controllers examples/<repo_name>

# Print out every controller name, grouped by super class
#
# This can find examples where security protections defined in a parent class
# (e.g. ApplicationController or Api::BaseController) aren't applied because
# the vulnerable controller didn't subclass the appropriate class.
$ python3 src/main.py --rails-controllers-by-superclass examples/<repo_name>

# For every before_action used by any controller, list the controllers that
# use that before_action and the routes that it is and isn't applied to
# (e.g. handle the 'except' and 'only" keywords)
#
# This can:
# * Give you quick insight the various before_actions the application defines,
#   yielding some intuition as to the code's flow and organization.
#   * `verify_with_otp` - Hm, that sounds interesting, I probably want to
#      review how that filter is implemented.
# * Show you where a given before_action is and isn't applied across an entire
#   code base, potentially leading to bugs where it is inconsistently used
#
# For example
# * Is there a before_action that's used to protect all state0-changing API
#   routes except for 1 model? That's strange.
# * Is there an authentication or authorization before_action applied to every
#   action in a controller except one? Why?
$ python3 src/main.py --rails-controllers-by-before_action examples/<repo_name>

파싱이 완료된 후 ipdb REPL로 빠져나와 파싱된 Ruby 코드를 대화형으로 검사하고 싶다면, 위 명령어에 --repl 플래그를 함께 전달하면 됩니다.

이 예제들은 ast_node.py에 정의된 다양한 AstNode 클래스에 의존하며, Rails 관련 코드는 모두 ruby.py에 있습니다.

JS 셸 exec()를 통한 명령 주입 찾기

이 구현은 아직 정리되고 문서화되지 않았습니다. main.py의 batch_parse_json()과 visitor.py의 visit() 및 그것이 호출하는 다른 메서드를 참조하세요.

소통하기

이 작업에 대해 더 자세히 이야기하고 싶다면 언제든지 이슈를 열거나 Twitter로 연락주세요: @clintgibler, @defreez.

이 프로젝트와 우리가 작업하는 다른 프로젝트에 대한 소식을 받아보고 싶다면 tl;dr sec 뉴스레터를 확인하세요. 주요 보안 발표의 상세 요약과 최고의 보안 도구 및 리소스 링크를 보내드립니다.

낮은 빈도로 발행되는 고신호 뉴스레터로, 최신 보안 동향을 놓치지 않도록 도와드리며, 업무를 더 효율적이고 효과적으로 수행할 수 있게 하고 정보 보안 동료들과 나눌 유용한 이야깃거리도 제공합니다.

도구 다운로드