Gokart는 GO 소스 코드의 SSA (단일 정적 할당) 형식을 사용하여 취약점을 찾는 GO의 정적 분석 도구입니다. 입력 소스가 안전한지 여부를 결정하기 위해 변수 및 함수 인수의 원인을 추적 할 수 있으며, 이는 다른 GO 보안 스캐너에 비해 잘못된 양성의 수를 줄입니다. 예를 들어, 변수와 연결된 SQL 쿼리는 전통적으로 SQL 주입으로 표시 될 수 있습니다. 그러나 Gokart는 변수가 실제로 일정한 또는 일정한 동등인지 여부를 파악할 수 있으며,이 경우 취약성이 없습니다.
Gokart는 또한 소스 코드 및 클라우드 환경에서 취약점을 찾고 관리 및 수정하는 데 도움이되는 Praetorian의 보안 플랫폼 인 Chariot에 전원을 공급하는 데 도움이됩니다. 전차를 사용하면 소스 코드에서 자동화되고 연속적인 Gokart 스캔을 간단하게 실행할 수 있습니다. Gokart를 시도하려면 여기를 클릭하여 몇 분 안에 무료 전차 계정을 설정할 수 있습니다.
정적 분석은 소스 코드에서 취약점을 찾는 강력한 기술입니다. 그러나이 접근법은 시끄럽고, 즉, 많은 정적 분석 도구는 실제로 실제가 아닌 "취약성"을 많이 발견했습니다. 이로 인해 사용자가 "울고있는 늑대"도구에 너무 많은 도구에 질려서 개발자 마찰이 발생했습니다.
Gokart의 동기는 다음을 해결하는 것이 었습니다. 기존 도구보다 오 탐지 속도가 상당히 낮은 스캐너를 만들 수 있습니까? 우리의 실험을 바탕으로 대답은 예입니다. Gokart는 소스-싱크 추적 및 SSA를 활용하여 가변 할당간에 변수 오염을 추적 할 수있어 결과의 정확도를 크게 향상시킬 수 있습니다. 우리의 초점은 유용성에 중점을 둡니다. 실용적으로, 그것은 우리가 잘못된 경보를 줄이기 위해 접근법을 최적화했다는 것을 의미합니다.
자세한 내용은 블로그 게시물을 읽으십시오.
아래에 나열된 옵션 중 하나를 사용하여 Gokart를 로컬로 설치할 수 있습니다.
go install 로 설치하십시오 $ go install github.com/praetorian-inc/gokart@latest릴리스 페이지에서 OS의 바이너리를 다운로드하십시오.
(선택 사항) checksums.txt 파일을 다운로드하여 아카이브의 무결성을 확인하십시오.
# Check the checksum of the downloaded archive
$ shasum -a 256 gokart_ ${VERSION} _ ${ARCH} .tar.gz
b05c4d7895be260aa16336f29249c50b84897dab90e1221c9e96af9233751f22 gokart_ ${VERSION} _ ${ARCH} .tar.gz
$ cat gokart_ ${VERSION} _ ${ARCH} _checksums.txt | grep gokart_ ${VERSION} _ ${ARCH} .tar.gz
b05c4d7895be260aa16336f29249c50b84897dab90e1221c9e96af9233751f22 gokart_ ${VERSION} _ ${ARCH} .tar.gz$ tar -xvf gokart_ ${VERSION} _ ${ARCH} .tar.gzgokart 이진을 길로 이동하십시오. $ mv ./gokart /usr/local/bin/ # clone the GoKart repo
$ git clone https://github.com/praetorian-inc/gokart.git
# navigate into the repo directory and build
$ cd gokart
$ go build
# Move the gokart binary into your path
$ mv ./gokart /usr/local/binDocker 이미지를 작성하십시오
docker build -t gokart .로컬 스캔으로 컨테이너 실행 (로컬 스캔 디렉토리는 컨테이너 이미지에 장착해야합니다)
docker run -v /path/to/scan-dir:/scan-dir gokart scan /scan-dir원격 스캔으로 컨테이너 실행 (인증 용 개인 키를 지정할 때 컨테이너에 장착해야합니다)
docker run gokart scan -r https://github.com/praetorian-inc/gokart
# specifying a private key for private repository ssh authentication
docker run -v /path/to/key-dir/:/key-dir gokart scan -r [email protected]:praetorian-inc/gokart.git -k /key-dir/ssh_key # running without a directory specified defaults to '.'
gokart scan < flags >gokart scan < directory > < flags > gokart help 아래 단계를 따라 Go Test Bench에서 Gokart를 실행할 수 있습니다.
# Clone sample vulnerable application
git clone https://github.com/Contrast-Security-OSS/go-test-bench.git
gokart scan go-test-bench/출력은 각각 취약한 기능과 사용자 입력 소스가 식별 된 일부 식별 된 취약점을 보여 주어야합니다.
추가 Gokart 기능을 테스트하려면 아래에 제안 된 CLI 플래그로 스캔 할 수 있습니다.
# Use verbose flag to show full traces of these vulnerabilities
gokart scan go-test-bench/ -v
# Use globalsTainted flag to ignore whitelisted Sources
# may increase false positive results
gokart scan go-test-bench/ -v -g
# Use debug flag to display internal analysis information
# which is useful for development and debugging
gokart scan go-test-bench/ -d
# Output results in sarif format
gokart scan go-test-bench/ -s
# Output results to file
gokart scan go-test-bench/ -o gokart-go-test-bench.txt
# Output scarif results to file
gokart scan go-test-bench/ -o gokart-go-test-bench.txt -s
# Scan remote public repository
# Repository will be cloned locally, scanned and deleted afterwards
gokart scan -r https://github.com/ShiftLeftSecurity/shiftleft-go-demo -v
# Specify the remote branch to scan
gokart scan -r https://github.com/ShiftLeftSecurity/shiftleft-go-demo -b actions_fix
# Scan remote private repository via ssh
gokart scan -r [email protected]:Contrast-Security-OSS/go-test-bench.git
# Scan remote private repository and optionally specify a key for ssh authentication
gokart scan -r [email protected]:Contrast-Security-OSS/go-test-bench.git -k /home/gokart/.ssh/github_rsa_key
# Use remote scan and output flags together for seamless security reviews
gokart scan -r https://github.com/ShiftLeftSecurity/shiftleft-go-demo -o gokart-shiftleft-go-demo.txt -v
# Use remote scan, output and sarif flags for frictionless integration into CI/CD
gokart scan -r https://github.com/ShiftLeftSecurity/shiftleft-go-demo -o gokart-shiftleft-go-demo.txt -s Gokart의 확장 성을 테스트하기 위해 Gokart가 분석에 새로운 취약한 싱크를 도입하기 위해 사용하는 구성 파일을 수정할 수 있습니다. util/analyzers.yml 의 포함 기본 구성 파일에 정의 된 테스트 싱크 분석기가 있습니다. util/analyzers.yml 수정하여 테스트 싱크 분석기에서 주석을 제거한 다음 Gokart를 지시하여 -i 플래그와 함께 수정 된 구성 파일을 사용하도록 지시합니다.
# Scan using modified analyzers.yml file and output full traces
gokart scan go-test-bench/ -v -i < path-to-gokart > /util/analyzers.yml출력에는 이제 사용자 입력을 통해 도달 할 수있는 새로운 "테스트 싱크"를 포함한 추가 취약점이 포함되어야합니다.
Gokart 루트 디렉토리에서 호출 된 다음 명령으로 포함 된 테스트를 실행할 수 있습니다.
go test -v ./...