Skip to content

fix: mask sensitive credentials in log output (CWE-312)#453

Merged
kimocoder merged 1 commit intomasterfrom
claude/fix-security-vulnerability-gQwUM
Mar 6, 2026
Merged

fix: mask sensitive credentials in log output (CWE-312)#453
kimocoder merged 1 commit intomasterfrom
claude/fix-security-vulnerability-gQwUM

Conversation

@kimocoder
Copy link
Copy Markdown
Owner

Passwords, PSKs, and WPA keys were being logged in clear text across multiple modules (eviltwin, pmkid, reaver, bully, attack_view). Added a mask_sensitive() helper to the logger utility and applied it at every call site so that only the first two characters of a secret are ever written to logs or the TUI log panel.

Resolves code-scanning alert #21 (clear-text logging of sensitive information).

Passwords, PSKs, and WPA keys were being logged in clear text across
multiple modules (eviltwin, pmkid, reaver, bully, attack_view). Added a
mask_sensitive() helper to the logger utility and applied it at every
call site so that only the first two characters of a secret are ever
written to logs or the TUI log panel.

Resolves code-scanning alert #21 (clear-text logging of sensitive
information).

https://claude.ai/code/session_01QnqEmyGsV4mNyeJULyGKCh
Copilot AI review requested due to automatic review settings March 6, 2026 02:04
@kimocoder kimocoder merged commit 930f572 into master Mar 6, 2026
10 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds centralized masking to prevent sensitive credentials (passwords/PSKs/keys) from being emitted in cleartext via logging/TUI output, addressing CWE-312 cleartext logging findings.

Changes:

  • Introduces mask_sensitive() helper in wifite/util/logger.py.
  • Applies masking at several credential/PSK log call sites across attack modules and TUI views.
  • Updates PMKID/EvilTwin/Reaver/Bully output paths to partially redact secrets (with some remaining cleartext paths noted in review comments).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
wifite/util/logger.py Adds mask_sensitive() helper for redacting sensitive strings in output.
wifite/ui/attack_view.py Masks password shown in successful credential capture log line in the TUI.
wifite/tools/reaver.py Masks PSK in TUI log line when WPS PSK is found.
wifite/tools/bully.py Masks WPS key in TUI log line when WPS key is found.
wifite/attack/pmkid.py Masks cracked PMKID password in logger and TUI log line.
wifite/attack/eviltwin.py Masks captured password in logger output and result creation log message.
Comments suppressed due to low confidence (1)

wifite/attack/pmkid.py:505

  • update_progress() is still emitting the cracked password in cleartext via the metrics dict ('Password': key). Since these metrics are rendered in the TUI, this undermines the masking work. Please store mask_sensitive(key) (or remove the password from metrics) and keep the real key only where it must be persisted (e.g., CrackResult).
            self.view.add_log(f"Password: {mask_sensitive(key)}")
            self.view.update_progress({
                'progress': 1.0,
                'status': 'PMKID cracked successfully!',
                'metrics': {
                    'Password': key,
                    'Status': 'SUCCESS'
                }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wifite/attack/pmkid.py
Comment on lines 497 to 501
self.view.add_log(f"Successfully cracked PMKID!")
self.view.add_log(f"Password: {key}")
self.view.add_log(f"Password: {mask_sensitive(key)}")
self.view.update_progress({
'progress': 1.0,
'status': 'PMKID cracked successfully!',
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to masking the log line, this success path still prints the cracked key in cleartext to the terminal a few lines later via Color.pattack(... % key). Please mask (or omit) the key in that terminal output too so credentials aren’t exposed outside of result storage.

Copilot uses AI. Check for mistakes.
Comment thread wifite/attack/eviltwin.py
log_info('EvilTwin', f'Valid credentials from {mac_address}: {mask_sensitive(password)}')
Color.pl('\n{+} {G}SUCCESS! Valid credentials captured:{W}')
Color.pl(' {C}From:{W} {G}%s{W}' % mac_address)
Color.pl(' {C}Password:{W} {G}%s{W}' % password)
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though the log_info(...) message is now masked, the console output immediately below still prints the captured password in cleartext (Color.pl(... % password)). If the intent is to avoid cleartext credential disclosure in any log/terminal output (CWE-312), please mask (or omit) the password in these Color.pl(...) lines as well.

Suggested change
Color.pl(' {C}Password:{W} {G}%s{W}' % password)
Color.pl(' {C}Password:{W} {G}%s{W}' % mask_sensitive(password))

Copilot uses AI. Check for mistakes.
Comment thread wifite/tools/reaver.py
Comment on lines +291 to 295
from ..util.logger import mask_sensitive
self.attack_view.add_log(f"PSK (Password): {mask_sensitive(psk)}")
self.attack_view.update_progress({
'progress': 1.0,
'status': 'WPS Cracked!',
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block still risks exposing the PSK in cleartext via outputs adjacent to the masked add_log(): the update_progress() payload immediately below includes 'PSK': psk (unmasked) and the subsequent console output (pattack(...)) prints psk as well. Please ensure any UI/terminal-facing strings and metrics use mask_sensitive(psk) (or omit the PSK entirely) to fully address CWE-312 at this call site.

Copilot uses AI. Check for mistakes.
Comment thread wifite/tools/bully.py
Comment on lines +329 to 333
from ..util.logger import mask_sensitive
self.attack_view.add_log(f"SUCCESS! Cracked WPS Key: {mask_sensitive(self.cracked_key)}")
self.attack_view.update_progress({
'progress': 1.0,
'status': 'WPS Cracked!',
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the log line is now masked, this success path still exposes the cracked key in cleartext elsewhere: update_progress() metrics includes 'PSK': self.cracked_key and the subsequent pattack(...) prints self.cracked_key to the terminal. Please mask (or omit) the key in all UI/terminal-facing outputs here to avoid reintroducing cleartext credential disclosure (CWE-312).

Copilot uses AI. Check for mistakes.
@kimocoder kimocoder deleted the claude/fix-security-vulnerability-gQwUM branch March 6, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants