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.
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.
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.