Skip to content
Business logic Disclosed report Beginner

Division by zero if terminal width is 2

A division by zero occurs in curl's progress bar code when the terminal width is exactly 2, causing the program to crash. An attacker who can influence the terminal width of a service using curl could make that service fail.

danielmarjamaki Follow

Originally disclosed on HackerOne

  • Disclosed after 13 months

Summary:

In fly() there will be a division by zero if progress bar width is 2.

That can happen if terminal width is 2.

Steps To Reproduce:

This script crash: stty rows 10 cols 2 ; curl --progress-bar somefile > temp

Impact

I believe that if it's possible to set terminal width for a service, then that service will not be able to curl.

The original report as published on HackerOne, by danielmarjamaki. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 progress bar drawing code does not guard against a terminal width small enough to make a divisor zero.

Impact

If a service's terminal width can be set to 2, that service may be unable to use curl because it crashes.

What the attacker needed

Terminal width set to 2; curl run with progress bar

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.

A program sometimes divides a number by the width of the terminal window to draw a progress bar. If that width is 2, the calculation divides by zero, which computers cannot do, so the program crashes. This only matters if something else can control how wide the terminal is.

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 from curl

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.