Defining a bear market is relatively simple: When the benchmark S&P 500 index falls by at least 20% from its all-time high, it enters bear market territory. The road to a new bull market, on the other hand, can be a little more complex.

Last week, the S&P 500 officially closed 20% above its October 2022 low point. Some analysts on Wall Street -- including those at Bank of America Securities -- called that the official start of a new bull market. Others disagree, asserting that the S&P 500 needs to reach a new high before the bear is officially back in hibernation. The index would need to rise another 11% to satisfy that criterion.

Two things are certain, however: First, the market is now much closer to a new high than it is to its October cyclical low, and second, the semantics don't matter one bit over the long term -- historically, the S&P 500 has always recovered from bears and entered new bull markets given enough time. With that in mind, here are two stocks to buy right now that will help your portfolio in a bull market.

1. Zscaler

Despite high inflation, boosted interest rates, and a slowing economy, the cybersecurity industry continues to be in high demand, generating exceptional growth. That's because corporations are increasingly reliant on cloud computing to run their businesses, making them more vulnerable to cyberattacks than ever before. Zscaler (ZS 1.28%) is an industry leader in zero trust cloud and identity security, and its business is performing so well that it just increased its full-year revenue guidance (again).

Employees tend to be the greatest source of vulnerability in a cloud network because they interact with so many external sources through email, messages, and when making online transactions. They pose particularly high risks to their company's digital security when working remotely. Their employer can't see them physically signing into a network from an on-site device, which makes it harder to be 100% certain it's them.

That's where Zscaler's Zero Trust Exchange comes in. It treats all login attempts as hostile, analyzing the user's location, device, and credentials to form a clearer picture of who is trying to gain access. Plus, the Zero Trust Exchange only connects the employee to the applications they're authorized to access, so even if a malicious actor does get into one aspect of a company's network, they won't be able to jump across to other assets within it.

The Zero Trust Exchange is the largest security cloud in the world, ingesting 300 trillion signals into its artificial intelligence (AI) models each day that it analyzes to improve its protective abilities.

Zscaler has more than 6,000 customers, including 30% of the world's largest 2,000 companies. In its fiscal 2023 third quarter (which ended April 30), it took in $418 million in revenue, which amounted to 46% growth year over year, comfortably beating its prior guidance. That prompted the company to raise its fiscal-year revenue forecast to $1.593 billion (at the high end of the range) -- the third time it has upped that guidance in fiscal 2023, despite the macroeconomic headwinds.

Since Zscaler stock trades 59% below its all-time high, investors should consider buying it now and taking it into the next bull market, particularly given the strength of its underlying business.

2. C3.ai

Interest in Artificial intelligence (AI) hit new heights among investors in 2023, and that reawakened the stock price of C3.ai (AI 3.02%). The company spent years pioneering AI for enterprises, though its stock price suffered a peak-to-trough collapse of 93% between 2020 and 2022. The company struggled to deliver the growth that investors were expecting, but thanks to an adjustment to its revenue model, that growth could be right around the corner.

C3.ai has built more than 40 plug-and-play AI applications for businesses in over a dozen different industries from financial services to energy. For many of them, C3.ai represents an onramp to AI technologies because they don't have the expertise to build that software from scratch in-house. For example, its Reliability application can help oil and natural gas companies predict equipment failures, which can potentially prevent financial and environmental disasters.

At the conclusion of its fiscal 2023 (which ended April 30), C3.ai had 287 customers -- up 35% from the end of its fiscal 2022. However, its revenue only grew by 5% to $266.8 million. That's because the company is in the middle of a transition from subscription-based pricing to consumption-based pricing. Subscription contracts take a long time to negotiate, which makes customer onboarding onerous. But with consumption pricing, new customers can sign up quickly and only pay for what they use.

But it will take time for those customers to scale up their activities under the new model, which is why C3.ai warned investors to expect a slowdown in revenue growth in the short term. But the company is guiding for up to 20% growth in the current fiscal year, and it's likely to accelerate beyond that starting in its fiscal 2025.

Investors have priced some of that expected growth into the stock, and the positive sentiment surrounding AI contributed to its buoyancy -- C3.ai's stock price surged 234% so far this year. It's still down 77% from its all-time high, which means this could be a great moment for investors to buy in. With a new bull market potentially around the corner, waiting until the company's growth accelerates in fiscal 2025 might be too late -- especially given all of the attention AI companies are getting now.