Just because a stock is cheap doesn't mean that it's a good value. More often than not, a cheap stock is cheap for a reason.

Sometimes the market takes it a little too far. This appears to be the case with AT&T (T 1.02%) and Hanesbrands (HBI 0.22%). While both stocks come with risks, either could soar as the companies work to pay down debt and convince investors they deserve more optimistic valuations.

AT&T

Shares of telecom giant AT&T are priced for disaster. There are certainly risks that investors shouldn't ignore, but a rock-bottom valuation, solid wireless growth, a booming fiber internet business, and progress paying down debt could all help fuel a major rally.

AT&T expects to produce at least $16 billion of free cash flow this year. With the company valued at $102 billion, the price-to-free-cash-flow ratio sits below 6.5. AT&T's balance sheet does pose a risk to free cash flow – as the company refinances debt in the years ahead, interest rates on new debt will likely be higher than interest rates on maturing debt. But AT&T's debt reduction efforts will help blunt the impact.

AT&T plans on knocking down its net debt, which stood at $132 billion at the end of the second quarter, by $4 billion in the second half of this year alone. For the next two years, the company will direct most free cash flow after dividends to further debt reduction. While this may not be enough to fully offset higher interest rates, profitability improvements will also help the cause.

AT&T's wireless business has slowed as consumers grapple with a tough economy, but the company is still gaining a few hundred thousand postpaid phone subscribers each quarter. EBITDA in the mobility segment grew faster than revenue in the second quarter, partly helped by the company's cost-cutting efforts.

The wireline business can also drive profit growth in the long run as revenue from new fiber customers more than offsets the decline of legacy services. AT&T gained 251,000 consumer fiber customers in the second quarter, pushing up quarterly fiber revenue to $1.5 billion. Once AT&T's fiber buildout is closer to completion, the intensity of capital spending related to fiber should decrease.

If AT&T can keep winning wireless subscribers and prove to investors that it's serious about improving its balance sheet, the stock could soar as the stock's valuation becomes less pessimistic.

Hanesbrands

Apparel manufacturer Hanesbrands has been struggling in the post-pandemic economy. Elevated inventory levels across the retail industry have pushed down demand and hit the company's top and bottom lines hard. Hanesbrands suspended its dividend earlier this year as it shifted its focus to paying down debt and making it through this difficult period.

Hanesbrands' second-quarter results showed decent progress. Sales were down 5% year over year, driven mostly by weakness in the activewear segment, but other metrics looked better. The company generated a positive free cash flow of $78 million, reduced its own inventory level by 7% from the first quarter, and reduced its debt by $100 million.

For the full year, Hanesbrands expects to eliminate $400 million of debt and produce around $450 million of free cash flow. The company is valued at about $1.9 billion, so the stock market is pricing the stock for catastrophe.

While a turnaround for Hanesbrands will take time, pressure from an activist investor could force the company to take more aggressive action. In a letter sent to Hanesbrands' Chairman, Barington Capital Group called for a big reduction in operating expenses, a more aggressive inventory reduction, and facility consolidations to speed up gross margin recovery. Barington also believes a new CEO and new board members may be required to successfully turn the company around .

Investing in Hanesbrands stock is not for the faint of heart, but if the company can get through this tough period while generating cash and paying down its debt, a big rally could be in the cards.