Safeguard
Application Security•

CWE-546 Suspicious Comments: What FIXME and HACK Are Telling You

Comments like TODO and HACK often mark missing security checks. A practical look at CWE-546 and how to clear them before release.

Safeguard Security Team
2 min read

CWE-546, Suspicious Comment, is a weakness about what your own code admits. MITRE says the code contains comments that suggest the presence of bugs, incomplete functionality or weaknesses.

It is a quality signal more than an exploit. But the signal is worth reading.

How it happens

Developers leave markers when they plan to come back. MITRE lists the usual suspects: BUG, HACK, FIXME, LATER, LATER2 and TODO. Many of them, MITRE notes, indicate missing security functionality and checking. Others point to code problems programmers should fix, such as hard-coded variables, error handling, not using stored procedures, and performance issues.

# TODO: check that the user owns this invoice
def get_invoice(invoice_id):
    return db.fetch_invoice(invoice_id)

That comment describes a missing authorization check. It also advertises it to anyone who can read the source.

What an attacker gains

MITRE frames the consequence as quality degradation. Suspicious comments may indicate problems in the source code that need fixing, and a sign of poor quality can lead to further bugs and the introduction of weaknesses. If the comments are visible to outsiders, they work as a guide to where the gaps are.

How to find it

  • Search the codebase for the markers above: BUG, HACK, FIXME, TODO, LATER.
  • Read each result with security in mind. Does it mark a missing check, a hard-coded value, or skipped error handling?
  • MITRE notes static analysis can find some instances of this weakness, and a simple grep gets most of them.
grep -rnE "FIXME|HACK|TODO|BUG|LATER" src/

How to fix it

MITRE's mitigation, under documentation, is to remove comments that suggest the presence of bugs, incomplete functionality or weaknesses before deploying the application. The better path is to resolve what they describe:

  1. Triage each marker. If it describes a security gap, fix it or open a tracked issue.
  2. Delete the comment only after the work is done or tracked elsewhere.
  3. Make the release pipeline list new markers so they get seen.
  4. Strip comments from anything shipped to a browser.

Quick check

Is deleting the comment the fix?

Removing it stops the advertisement but not the problem. Fix the gap or track it, then clear the comment.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.