T09 · Insecure Skill Coding Practices
- Location
scripts/remote_installer.py:69- Finding
RustDesk Credentials Are Persisted in Plaintext Logs
- Content
View full analysis
Vulnerability Details
File Location:
scripts/remote_installer.py, lines 69-70; logging destination configured at lines 250-257
Vulnerability Type: Plaintext sensitive-data exposure
Risk Level: HighVulnerable Code
python def connect(self, remote_id, password, timeout=60): """连接到远程电脑""" logging.info(f"开始连接 RustDesk: ID={remote_id}, 密码={password}")The message is persisted by the following logging configuration:
python logging.basicConfig( level=log_level, format='%(asctime)s - %(levelname)s - %(message)s', handlers=[ logging.FileHandler(log_path, encoding='utf-8'), logging.StreamHandler() ] )Technical Analysis
The
connectmethod interpolates both the RustDesk remote ID and password into an informational log message. The configuredFileHandlerwrites this message toscripts/installer.log, leaving reusable remote-access credentials in plaintext on disk.The password is also emitted through the stream handler, potentially exposing it to terminal capture, redirected output, parent-process logging, or centralized log collection. Passwords must not be treated as ordinary diagnostic data.
Attack Path
- A user starts a remote installation and supplies a valid RustDesk ID and password.
RustDeskController.connect()constructs a log message containing both credentials.- The logging framework writes the message to
scripts/installer.logand standard error. - A local user, process, backup service, support bundle, or log collector obtains the log.
- The exposed credentials are reused to attempt unauthorized access to the corresponding RustDesk endpoint.
Impact Assessment
Successful exploitation exposes credentials capable of granting interactive remote-machine access. The resulting privileges depend on the RustDesk session and the account active on the remote system. If the connected session is adminis ...[truncated 280 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the password from every log statement and exception message.
- Log only a minimally identifying, masked remote ID when operationally necessary.
- Replace the vulnerable message with a constant message such as
logging.info("Starting RustDesk connection"). - Configure restrictive filesystem permissions for
installer.log. - Avoid forwarding logs containing authentication context to shared collectors.
- Add a logging filter that redacts known secret fields as defense in depth.
- Rotate RustDesk passwords that may already have been written to existing logs.
- Avoid accepting passwords through command-line arguments; use a protected prompt, standard input, environment-specific secret provider, or OS credential manager.
