The S&P 500 is just 4 percentage points from a record high -- and bull market territory. That threshold is noteworthy because the broad index returned an average of 169% during the last dozen bull markets, and many stocks are sure to skyrocket during the next one.

Some are already on a tear. Cloudflare (NET 1.44%) and Zscaler (ZS 1.28%) have quadrupled in the last four years, with shares soaring 320% and 326%, respectively. But the companies have strong positions in markets backed by persistent tailwinds, and that could carry both stocks higher during the next bull market.

1. Cloudflare

The tailwinds driving Cloudflare are growing demand for zero trust security and developer tools, especially those related to artificial intelligence (AI). The company offers a broad range of cloud services that accelerate and protect business applications and infrastructure, while eliminating the need for costly on-premises hardware.

Cloudflare stands apart in terms of performance and scale. It operates the fastest cloud network on the market, and its technology powers about 20% of the internet. That statistic points to a considerable data advantage. With deep insight into performance and security issues across the web, Cloudflare can continuously route traffic and block threats more effectively.

Business looked strong in the third quarter. Cloudflare's customer count climbed 17% to 182,000 and the average customer spent 16% more. In turn, revenue increased 32% to $336 million and the company achieved its fifth consecutive quarter of record operating profits.

That momentum should carry into future quarters. Independent research firms recently recognized Cloudflare as a leader in zero trust network access (alongside Zscaler and Palo Alto Networks) and edge development platforms, two product categories that account for most of its $146 billion market opportunity.

Building on that, management believes AI will be a significant catalyst for its developer services business. "Cloudflare is the most commonly used cloud provider across leading AI start-ups," according to CEO Matthew Prince. "We're uniquely positioned to become a leader in AI inferencing."

To that end, Cloudflare ranked No. 6 on Fortune's Future 50 List for 2023, a report aimed at identifying companies best positioned for long-term revenue growth. Shares currently trade at 21.3 times sales, a bargain compared to the three-year average of 39.1 times sales and a reasonable price in context. Patient investors comfortable with volatility should feel confident buying a small position in this cloud stock today.

2. Zscaler

The tailwinds driving Zscaler are demand for zero trust networking and cloud workload protection. The company's security service edge (SSE) platform modernizes corporate networks by handling traffic inspection and policy enforcement in the cloud rather than private data centers. In doing so, Zscaler allows users to securely access private applications, cloud services, and the open internet from any device or location, without the complexity of on-premises appliances.

Zscaler has distinguished itself through scale and superior threat protection. Specifically, as the largest network security cloud, the company captures over 500 trillion security signals daily that feed its AI models, each one improving its ability to detect anomalies. CEO Jay Chaudhry says that network effect results in superior threat protection.

The company reported strong results in the fiscal fourth quarter (ended July 31). Its customer count increased 14% to 7,700 and the average customer spent north of 20% more. In turn, revenue climbed 43% to $455 million and non-GAAP net income soared 177% to $101 million. Investors have good reason to think that momentum will carry into future quarters.

Zscaler has hardly tapped its $72 billion addressable market, but the company is well-positioned to capitalize on that opportunity given its strong position in the zero trust network access and SSE markets. Indeed, Morgan Stanley says the company is gaining market share more quickly than any other SSE vendor. That is particularly noteworthy because research firm Gartner believes 80% of enterprises will adopt SSE architecture by 2025, up from 20% in 2021.

To that end, Zscaler ranked No. 25 on the Fortune's Future 50 List for 2023, and Morgan Stanley expects revenue to grow at 25% annually over the next five years. In that context, its current valuation of 16.5 times sales seems fair, and it's a significant discount to the three-year average of 31.3 times sales. Patient investors who can handle some ups and downs should consider buying a few shares of this cybersecurity stock today.