
Fnord는 난독화된 코드를 위한 패턴 추출기입니다.
Fnord는 두 가지 주요 기능을 가지고 있습니다:
Fnord는 파일을 다양한 크기의 슬라이딩 윈도우로 처리하여 최소 길이 -m X (기본값: 4)부터 최대 길이 -x X (기본값: 40)까지 모든 시퀀스를 추출합니다. 각 길이에 대해 Fnord는 가장 자주 발생하는 시퀀스 -t X (기본값: 3)를 테이블에 표시합니다.
테이블의 각 줄에는 다음이 포함됩니다:
Fnord는 또한 실험적인 YARA 규칙을 생성합니다. YARA 규칙 생성 중에는 시퀀스의 길이와 발생 횟수(길이 * 발생 횟수)를 기반으로 점수를 계산합니다. 그런 다음 각 시퀀스에서 모든 비문자 문자를 제거하고 키워드 목록(대소문자 구분 없음)과 비교하여 다른 시퀀스보다 더 흥미로운 시퀀스를 감지합니다. 규칙에 각 문자열을 작성하기 전에 Fnord는 Levenshtein 거리를 계산하고 이미 규칙에 통합된 시퀀스와 너무 유사한 시퀀스를 건너뜁니다.
[실험적] Fnord는 며칠 전에 만들어졌으며 몇 가지 샘플로 테스트했습니다. 향후 몇 주 내에 기본값을 조정하고 더 많은 키워드, 필터, 점수 옵션을 추가할 것으로 예상합니다.
샘플에서 난독화된 코드를 발견한 경우 16진수 편집기를 사용하여 샘플의 난독화된 부분을 추출하고 새 파일로 저장하십시오. 분석에는 해당 새 파일을 사용하십시오.
-s, -k, -r, --yara-strings, -m 및 -e 플래그를 실험해 보십시오.
약한 YARA 규칙을 생성하는 샘플이 있으면 보내주시기 바랍니다. 더 나은 규칙을 만들 수 있습니다.
____ __
/ __/__ ___ _______/ /
/ _// _ \/ _ \/ __/ _ /
/_/ /_//_/\___/_/ \_,_/ Pattern Extractor for Obfuscated Code
v0.7, Florian Roth
usage: fnord.py [-h] [-f file] [-m min] [-x max] [-t top] [-n min-occ]
[-e min-entropy] [--strings] [--include-padding] [--debug]
[--noyara] [-s similarity] [-k keywords-multiplier]
[-r structure-multiplier] [-c count-limiter] [--yara-exact]
[--yara-strings max] [--show-score] [--show-count]
[--author author]
Fnord - Pattern Extractor for Obfuscated Code
optional arguments:
-h, --help show this help message and exit
-f file File to process
-m min Minimum sequence length
-x max Maximum sequence length
-t top Number of items in the Top x list
-n min-occ Minimum number of occurrences to show
-e min-entropy Minimum entropy
--strings Show strings only
--include-padding Include 0x00 and 0x20 in the extracted strings
--debug Debug output
YARA Rule Creation:
--noyara Do not generate an experimental YARA rule
-s similarity Allowed similarity (use values between 0.1=low and
10=high, default=1.5)
-k keywords-multiplier
Keywords multiplier (multiplies score of sequences if
keyword is found) (best use values between 1 and 5,
default=2.0)
-r structure-multiplier
Structure multiplier (multiplies score of sequences if
it is identified as code structure and not payload)
(best use values between 1 and 5, default=2.0)
-c count-limiter Count limiter (limts the impact of the count by
capping it at a certain amount) (best use values
between 5 and 100, default=20)
--yara-exact Add magic header and magic footer limitations to the
rule
--yara-strings max Maximum sequence length
--show-score Show score in comments of YARA rules
--show-count Show count in sample in comments of YARA rules
--author author YARA rule author
git clone https://github.com/Neo23x0/Fnord.git 그리고 cd Fnordpip3 install -r ./requirements.txtpython3 ./fnord.py --helppython3 fnord.py -f ./test/wraeop.sct --yara-strings 10
python3 fnord.py -f ./test/vbs.txt --show-score --show-count -t 1 -x 20
python3 fnord.py -f ./test/inv-obf.txt --show-score --show-count -t 1 --yara-strings 4 --yara-exact



./test 폴더에는 악성 스크립트가 포함되어 있으며 로컬 안티바이러스 스캐너에서 감지될 수 있습니다. 실행하지 않는 한 시스템에 해를 끼치지 않습니다.
yarGen은 화이트리스트 접근 방식을 사용하여 YARA 규칙 생성에 가장 적합한 문자열을 필터링합니다. yarGen은 일부 정규식을 적용하여 YARA 규칙을 만들기 전에 문자열의 점수를 조정합니다. 그러나 그 접근 방식은 통계를 기반으로 바이트 시퀀스의 점수를 계산하는 Fnord가 사용하는 방법과 매우 다릅니다.
yarGen은 난독화되지 않은 코드에 가장 적합하게 사용되는 반면, Fnord는 난독화된 코드 전용이며 yarGen보다 훨씬 더 나은 결과를 생성해야 합니다.
업데이트를 위해 Twitter에서 저를 팔로우하세요 @cyb3rops