Skip to content

Commit 93aaada

Browse files
committed
little fixes
1 parent 09438ca commit 93aaada

11 files changed

+27
-10
lines changed

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ services:
2121
- /root/.ghidra/
2222
- /root/.routersploit/
2323
- /root/.msf4
24+
- /root/.john
2425
- /run/lock
2526
- /var/run
2627
- /var/tmp

helpers/helpers_emba_defaults.sh

+1
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,5 @@ set_defaults() {
131131
export TOTAL_MEMORY=0
132132
TOTAL_MEMORY="$(grep MemTotal /proc/meminfo | awk '{print $2}' || true)"
133133
export Q_MOD_PID=""
134+
export F20_SOURCE="" # F20 module - set to cve-discovery caller for further processing
134135
}

helpers/helpers_emba_dependency_check.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,9 @@ dependency_check()
517517
check_dep_file "Binarly FwHunt analyzer" "${EXT_DIR}""/fwhunt-scan/fwhunt_scan_analyzer.py"
518518

519519
if function_exists F20_vul_aggregator; then
520-
check_dep_file "NVD CVE database" "${EXT_DIR}""/nvd-json-data-feeds/README.md"
520+
if ! [[ -f "${CONFIG_DIR}"/gh_action ]]; then
521+
check_dep_file "NVD CVE database" "${EXT_DIR}""/nvd-json-data-feeds/README.md"
522+
fi
521523
# CVE searchsploit
522524
check_dep_tool "CVE Searchsploit" "cve_searchsploit"
523525

installer/IF20_nvd_feed.sh

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ IF20_nvd_feed() {
3737
echo -e "\\n""${MAGENTA}""Check if the NVD JSON data feed is already installed and populated.""${NC}"
3838
if [[ "${GH_ACTION}" -eq 1 ]]; then
3939
echo "[*] Github action - not installing NVD database"
40+
echo "GH_action:true" > ./config/gh_action || true
4041
return
4142
fi
4243
if [[ -d external/nvd-json-data-feeds ]]; then

modules/F20_vul_aggregator.sh

+15-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ F20_vul_aggregator() {
2222
module_title "Final vulnerability aggregator"
2323

2424
pre_module_reporter "${FUNCNAME[0]}"
25+
26+
# we use this for later decisions:
27+
export F20_SOURCE="${FUNCNAME[0]}"
2528
print_ln
2629

2730
prepare_cve_search_module
@@ -481,7 +484,11 @@ cve_db_lookup_cve() {
481484
echo "${CVE_ID}:${CVE_V2:-"NA"}:${CVE_V31:-"NA"}" > "${LOG_PATH_MODULE}"/"${CVE_ENTRY}".txt || true
482485
fi
483486

484-
cve_extractor "${CVE_ENTRY}"
487+
# only do further analysis if needed
488+
# in case we come from s26 module we do not need all the upcoming analysis
489+
if [[ "${F20_SOURCE}" == "F20_vul_aggregator" ]]; then
490+
cve_extractor "${CVE_ENTRY}"
491+
fi
485492
}
486493

487494
cve_db_lookup_version() {
@@ -493,6 +500,7 @@ cve_db_lookup_version() {
493500

494501
# we create something like "binary_1.2.3" for log paths
495502
local VERSION_PATH="${BIN_VERSION_//:/_}"
503+
# we test for the binary_name:version and for binary_name:*:
496504
print_output "[*] CVE database lookup with version information: ${ORANGE}${BIN_VERSION_}${NC}" "no_log"
497505

498506
BIN_NAME=$(echo "${BIN_VERSION_}" | cut -d':' -f1)
@@ -521,7 +529,11 @@ cve_db_lookup_version() {
521529

522530
[[ "${THREADED}" -eq 1 ]] && wait_for_pid "${WAIT_PIDS_F19_CVE_SOURCE[@]}"
523531

524-
cve_extractor "${BIN_VERSION_}"
532+
# only do further analysis if needed
533+
# in case we come from s26 module we do not need all the upcoming analysis
534+
if [[ "${F20_SOURCE}" == "F20_vul_aggregator" ]]; then
535+
cve_extractor "${BIN_VERSION_}"
536+
fi
525537
}
526538

527539
# Test the identified JSON files for CPE details and version information
@@ -865,7 +877,7 @@ cve_extractor() {
865877
if grep -q "${BINARY};.*${VERSION}" "${S36_LOG}" 2>/dev/null; then
866878
if [[ "${VSOURCE}" == "unknown" ]]; then
867879
VSOURCE="STAT"
868-
else
880+
elif ! [[ "${VSOURCE}" =~ .*STAT.* ]]; then
869881
VSOURCE="${VSOURCE}""/STAT"
870882
fi
871883
fi

modules/S13_weak_func_check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ print_top10_statistics() {
466466
for FUNCTION in "${VULNERABLE_FUNCTIONS[@]}" ; do
467467
local SEARCH_TERM=""
468468
local F_COUNTER=0
469-
readarray -t RESULTS < <( find "${LOG_PATH_MODULE}" -xdev -iname "vul_func_*_""${FUNCTION}""-*.txt" 2> /dev/null | sed "s/.*vul_func_//" | sort -g -r | head -10 | sed "s/_""${FUNCTION}""-/ /" | sed "s/\.txt//" 2> /dev/null || true)
469+
readarray -t RESULTS < <( find "${LOG_PATH_MODULE}" -xdev -iname "vul_func_*_""${FUNCTION}""-*.txt" 2> /dev/null | sed "s/.*vul_func_//" | sort -g -r | head -10 | sed "s/_""${FUNCTION}""-/ /" | sed "s/\.txt//" | grep -v "^0\ " 2> /dev/null || true)
470470

471471
if [[ "${#RESULTS[@]}" -gt 0 ]]; then
472472
print_ln

modules/S14_weak_func_radare_check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ radare_print_top10_statistics() {
458458
for FUNCTION in "${VULNERABLE_FUNCTIONS[@]}" ; do
459459
local SEARCH_TERM=""
460460
local F_COUNTER=0
461-
readarray -t RESULTS < <( find "${LOG_PATH_MODULE}" -xdev -iname "vul_func_*_""${FUNCTION}""-*.txt" 2> /dev/null | sed "s/.*vul_func_//" | sort -g -r | head -10 | sed "s/_""${FUNCTION}""-/ /" | sed "s/\.txt//" 2> /dev/null || true)
461+
readarray -t RESULTS < <( find "${LOG_PATH_MODULE}" -xdev -iname "vul_func_*_""${FUNCTION}""-*.txt" 2> /dev/null | sed "s/.*vul_func_//" | sort -g -r | head -10 | sed "s/_""${FUNCTION}""-/ /" | sed "s/\.txt//" | grep -v "^0\ " 2> /dev/null || true)
462462

463463
if [[ "${#RESULTS[@]}" -gt 0 ]]; then
464464
print_ln

modules/S15_radare_decompile_checks.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ radare_decomp_print_top10_statistics() {
167167
for FUNCTION in "${VULNERABLE_FUNCTIONS[@]}" ; do
168168
local SEARCH_TERM=""
169169
local F_COUNTER=0
170-
readarray -t RESULTS < <( find "${LOG_PATH_MODULE}" -xdev -iname "vul_func_*_""${FUNCTION}""-*.txt" 2> /dev/null | sed "s/.*vul_func_//" | sort -g -r | head -10 | sed "s/_""${FUNCTION}""-/ /" | sed "s/\.txt//" 2> /dev/null || true)
170+
readarray -t RESULTS < <( find "${LOG_PATH_MODULE}" -xdev -iname "vul_func_*_""${FUNCTION}""-*.txt" 2> /dev/null | sed "s/.*vul_func_//" | sort -g -r | head -10 | sed "s/_""${FUNCTION}""-/ /" | sed "s/\.txt//" | grep -v "^0\ " 2> /dev/null || true)
171171

172172
if [[ "${#RESULTS[@]}" -gt 0 ]]; then
173173
print_ln

modules/S20_shell_check.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ S20_shell_check()
7777
fi
7878

7979
if [[ ${SEMGREP} -eq 1 ]] ; then
80-
sub_module_title "Check scripts with semgrep"
80+
sub_module_title "Check shell scripts with semgrep"
8181
local S20_SEMGREP_SCRIPTS=0
8282
local S20_SEMGREP_VULNS=0
8383
local SHELL_LOG="${LOG_PATH_MODULE}"/semgrep.log
@@ -118,8 +118,6 @@ s20_eval_script_check() {
118118
local GPT_PRIO_=3
119119
local GPT_ANCHOR_=""
120120

121-
sub_module_title "Check shell scripts for eval usage"
122-
123121
for SH_SCRIPT in "${SH_SCRIPTS_[@]}" ; do
124122
print_output "[*] Testing ${ORANGE}${SH_SCRIPT}${NC} for eval usage" "no_log"
125123
if grep "eval " "${SH_SCRIPT}" | grep -q -v "^#.*"; then

modules/S26_kernel_vuln_verifier.sh

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ S26_kernel_vuln_verifier()
189189
tar -xzf "${KERNEL_ARCH_PATH}/linux-${K_VERSION_KORG}.tar.gz" -C "${LOG_PATH_MODULE}"
190190
fi
191191

192+
print_output "[*] Kernel version ${ORANGE}${K_VERSION}${NC} CVE detection ... "
192193
prepare_cve_search_module
193194
cve_db_lookup_version "linux_kernel:${K_VERSION}"
194195

modules/S99_grepit.sh

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ grepit_search() {
174174
# this is the output to the terminal. For the final report we wait till all tests are finished and then we
175175
# parse the csv output file and sort it according the test priority - 1-9, where 1 is more interesting
176176
# (low false positive rate, certainty of "vulnerability") and 9 is only "you might want to have a look when you are desperately looking for vulns")
177+
print_ln
177178
print_output "[*] ${ORANGE}${LINES_OF_OUTPUT}${NC} results of grepit module ${ORANGE}${CURRENT_TEST}${NC}." "no_log"
178179
write_csv_log "${CURRENT_TEST}" "${LINES_OF_OUTPUT}" "${ARGS_FOR_GREP[*]}" "${SEARCH_REGEX}" "${COMMENT}"
179180
fi

0 commit comments

Comments
 (0)