NULL Pointer Dereference
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL.
NULL pointer dereferences typically cause the application to crash. In some cases, they may be exploitable for denial of service or potentially for code execution.
보급률
보통
2개 언어 지원
영향
보통
검토 권장
예방
문서화됨
2개의 수정 예시
2 예방
2 예방
이 취약점을 수정하는 방법
Unsafe Type Assertion Without Ok Check
MEDIUM
Use the two-value form of type assertion or type switch to handle failures gracefully
- func processData(data interface{}) { - m := data.(map[string]interface{}) - fmt.Println(m["key"]) + func processData(data interface{}) error { + m, ok := data.(map[string]interface{}) + if !ok { + return errors.New("invalid data type") + } + fmt.Println(m["key"]) + return nil }
JavaScript
모두 보기 JavaScript 자세히 →
Non-Null Assertion Without Null Check
LOW
Replace non-null assertions (!) with explicit null checks or optional chaining
interface Config { database?: { host: string; port: number; }; } function connect(config: Config) { - const host = config.database!.host; - const port = config.database!.port; + if (!config.database) { + throw new Error('Database configuration is required'); + } + const { host, port } = config.database; return createConnection(host, port); }
3 탐지
3 탐지
코드에서 취약점 찾기
Shoulder를 사용하여 코드에서 NULL Pointer Dereference 패턴을 스캔하세요. 2 규칙.
# Scan with Shoulder CLI npx @shoulderdev/cli trust --cwe=476 # Or scan entire project npx @shoulderdev/cli trust .
탐지 규칙 (2)
🐹
Go
1 rules
4 경고 신호
4 경고 신호
코드 리뷰에서 주의할 점
이 패턴은 잠재적인 NULL Pointer Dereference 취약점을 나타냅니다. 코드 리뷰와 보안 감사 중에 찾아보세요.
Non-null assertion (!), used on '...' without explicit null/undefined check. This may cause runtime crashes if the value
typescript-non-null-assertion
코드베이스를 스캔하세요: NULL Pointer Dereference
Shoulder CLI는 전체 코드베이스에서 취약한 패턴을 찾아냅니다.