Skip to content
Business logic Advisory Intermediate CVE-2015-7976

Network Time Protocol ntpq Special Character Filtering Vulnerability

The ntpq saveconfig command does not adequately filter special characters in filenames, allowing characters like a leading dash and strftime format specifiers that insert newlines or tabs. An authenticated ntpq user could create filenames that, when an administrator runs commands with wildcards, may cause unintended command execution or other issues.

Jonathan Gardner Follow

Originally disclosed on Cisco Talos

The ntpq saveconfig command does not do adequate filtering of special characters from the supplied filename. Only back slash and forward slash are currently filtered out.

Jonathan Gardner, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the save_config() function only filters backslash and forward slash, and also calls strftime() on user-supplied format specifiers, allowing other special characters and whitespace into filenames.

Impact

An authenticated ntpq user could create filenames that, when an administrator runs commands with wildcards, may lead to unintended command execution or other issues, though the report notes the example is extreme and unlikely.

What the attacker needed

Authenticated ntpq user; admin runs wildcard command in config dir

The fix

The save_config() function should filter out special characters except dot, underscore, and dash, disallow filenames starting with those characters, and disallow %n and %t format specifiers; a more conservative approach would be to remove the strftime() call entirely.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

The ntpq tool lets an authenticated user save configuration to a file they name. The program only blocks slashes, so a user can include other special characters, such as a leading dash or a newline, in the filename. If an administrator later runs a command like 'rm *' in that folder, the shell may interpret those characters in unexpected ways, potentially causing harm.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Jonathan Gardner

View all

3 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.