T09 · Insecure Skill Coding Practices
- Location
blaze-fan.sh:19- Finding
Unvalidated Model-Specific EC Register Writes
- Content
View full analysis
/dev/null)" = "Y" ] } detect_backend() { if ec_ready; then echo "ec" elif [ -x "$FAN_CLEVO" ]; then echo "clevo" elif [ -x "$FAN_NBFC" ]; then echo "nbfc" else die "No available fan backend" fi } ``` ```bash ec_write() { printf "\\x$(printf '%02x' "$2")" | dd of="$FAN_EC_IO" bs=1 seek=$((0x$1)) conv=notrunc 2>/dev/null || warn "EC write failed @0x$1" } set_fan() { local duty=$1 case "$BACKEND" in ec) local speed=$(( duty * 255 / 100 )) local cmd_dec=$((FAN_EC_CMD)) local i for ((i=1; i<=FAN_EC_COUNT; i++)); do ec_write "${FAN_EC_FDAT#0x}" "$i" ec_write "${FAN_EC_FBUF#0x}" "$speed" ec_write "${FAN_EC_FCMD#0x}" "$cmd_dec" done ;; clevo) "$FAN_CLEVO" "$duty" >/dev/null 2>&1 ;; nbfc) "$FAN_NBFC" set -s "$duty" >/dev/null 2>&1 ;; esac } ``` ```bash # Write 50% once to activate manual mode set_fan 50 ``` ### Technical Analysis The raw EC backend is selected solely because the EC debug interface is readable and the kernel reports that writes are enabled. These checks establish access to the controller but do not establish that the configured registers implement the ...[truncated 1724 chars]- Remediation
View remediation
