dns/ddclient: DuckDNS token is written to syslog in clear text when the update request fails (native backend)

Open Beginner friendly
#5,863 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

The leak is in the except Exception block of the DuckDNS account class in lib/account/duckdns.py, where str(e) goes straight to syslog.syslog. Start by confirming that the request URL with the token reaches that exception text, then catch the error and log a message that omits the URL or redacts the password value. Done means a failed update never writes the token to syslog, and you have checked whether other account classes in lib/account/ have the same pattern.

Written by the indexing model from the issue text.

Description

Important notices

Describe the bug

With the native backend, lib/account/duckdns.py sends the token as a query parameter
(requests.get(proto+'://www.duckdns.org/update', data)) and on any exception logs str(e):

except Exception as e:
    syslog.syslog(syslog.LOG_ERR, str(e))

For connection errors, requests includes the full request URL in the exception text, so the
log line contains the token in clear text, e.g.

HTTPSConnectionPool(host='www.duckdns.org', port=443): Max retries exceeded with url:
/update?domains=<name>&token=<TOKEN IN CLEAR TEXT>&ip=<ip> (Caused by ...)

The line is logged at LOG_ERR, so it also reaches every remote syslog target. Anyone who can read
the logs (locally or on the log server) can then repoint the DuckDNS name.

To Reproduce

  1. Configure a DuckDNS account in Services → Dynamic DNS (native backend).
  2. Make the first update fail at network level, e.g. right after a PPPoE reconnect before the
    line is ready (this is how we saw it, twice in the last eight weeks), or by temporarily blocking
    www.duckdns.org.
  3. Look at the system log / remote syslog: the ddclient error line contains token=....

Expected behavior

Credentials never appear in log output. For example, catch the exception and log without the URL,
or redact the token before logging:

except Exception as e:
    msg = str(e).replace(self.settings.get('password') or '\0', '***')
    syslog.syslog(syslog.LOG_ERR, f"DuckDNS update failed for {self.description}: {msg}")

(The dyndns2-based services are not affected: they send credentials via HTTPBasicAuth, so the
URL in an exception contains no secret. Other account classes that put secrets into the URL
may deserve the same check.)

Environment

  • OPNsense 26.7.8_1 (amd64)
  • os-ddclient as shipped with 26.7.8_1, native backend
Dominant language
PHP
Stars
1.2k
Forks
905
Avg merge
4d 19h
Merged PRs (30d)
16

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opnsense/plugins

All issues in opnsense/plugins

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.