There's little question that the stock market is currently expensive. The S&P 500 sports a price-to-earnings ratio in the mid-20s, well above its historical average, and many high-quality stocks trade for even loftier multiples. Cheap stocks in this environment are few and far between.

But if you look hard enough, there are still some bargains to be found. Bed Bath & Beyond (BBBY), Acacia Communications (ACIA), and Chicago Bridge & Iron (CBI) are all trading at depressed valuations. All three stocks come with significant risks, and all three could burn you if things go wrong. But there's plenty of upside if the worst-case scenarios fail to play out.

A sign post with four signs that say "Sale!" pointing in different directions.

Image source: Getty Images.

A retailer with a big problem

Bed Bath & Beyond is doing better than many other retailers. Fourth-quarter comparable sales grew by 0.4%, driven by 20% growth in online sales. The stores suffered a low single-digit decline, but an overall increase in sales makes Bed Bath & Beyond's results look stellar compared to some parts of the retail sector, particularly department stores.

The bottom line, however, is different story. As Bed Bath & Beyond shifts sales online, and as it continues to send out an unending stream of its ubiquitous "20% off" coupons, margins are taking a hit. Both gross and operating margins have been in decline since 2012, and net income has slumped by 34% from its peak. Share buybacks have boosted per-share earnings, but the company expects EPS to fall by as much as 10% in 2017.

BBBY Chart

BBBY data by YCharts.

Slumping earnings have dragged down the stock price, creating an interesting situation for investors looking for cheap stocks. Assuming EPS does fall by 10%, the stock currently trades for just 8.5 times forward earnings. The market is betting that things keep getting worse, and they very well may. But if Bed Bath & Beyond can stabilize the bottom line, that valuation will look overly pessimistic in retrospect. There's significant risk here, especially if sales begin to decline. But the valuation makes opening a small position tempting.

A small, cheap tech company

Acacia Communications makes optical interconnect products, counting cloud infrastructure providers and communication service providers as customers. Like with any small tech company, predicting the future is next to impossible. But Acacia has enjoyed both strong growth and impressive profitability over the past few years, and the stock is priced at what looks like a pessimistic level.

ACIA Chart

ACIA data by YCharts.

Shares of Acacia are down about 60% from their peak, and they recently took a big hit when the company guided for a significant revenue decline during the second quarter. The culprit is weak demand in China, which is affecting not only Acacia but the entire industry. The company expects this to be a temporary slowdown, with growth returning during the second half.

Acacia's market capitalization is now around $1.85 billion, about 15 times last year's adjusted earnings and 22 times analyst estimates for 2017 adjusted earnings. If the China slowdown turns out to be truly temporary, the stock could soar as the company returns to revenue and earnings growth in 2018. But if weak demand persists for longer than expected, the stock could tumble further. If a cheap small-cap tech stock is what you're after, Acacia is one to consider.

A beaten-down, century-old company

Shares of Chicago Bridge & Iron, a century-old engineering and construction company, have been hammered over the past few years. The stock is down a whopping 77% from its peak in early 2014, driven by a couple of factors. First, an ongoing legal dispute between CB&I and Westinghouse over CB&I's sale of its nuclear construction business could cost the company billions of dollars. Second, weak demand for its services, particularly in the energy sector, has led to slumping revenue and profits.

CBI Chart

CBI data by YCharts.

Revenue tumbled 17.4% in 2016, and CB&I reported a $313 million net loss, its second consecutive year of losses. Adjusted net income was $438 million last year, with the discrepancy due to various charges related to cost-to-complete estimates for its projects. The company expects to produce adjusted EPS between $3.50 and $4.00 in 2017, putting the stock price at just 5.4 times the midpoint of that range.

The Westinghouse lawsuit creates a lot of uncertainty, especially since CB&I's market capitalization is now just $2 billion, the same amount Westinghouse claims it's owed. On top of that, the company will need to turn its business around and return to earnings growth. A new CEO is taking the helm on July 1, with a challenging task ahead.

If the lawsuit doesn't go terribly wrong for CB&I, the stock could soar due to its beaten-down valuation alone. There's a lot of uncertainly and a lot of risk, but a single-digit earnings multiple should put the stock on your radar.