The S&P 500 (SNPINDEX: ^GSPC) has rebounded sharply from its bear market lows amid cooling inflation. The benchmark index is now just 7% below its all-time high, which puts it within striking distance of bull market territory. That's good news for investors.

The S&P 500 returned an average of 186% during the nine bull markets since 1970, according to Hartford Funds. And whether the next bull market begins in a week, a month, or a year, investors can count on the fact that its arrival will drive many stocks much higher.

Here are two magnificent growth stocks to buy before that happens.

1. HubSpot

HubSpot (HUBS -0.78%) specializes in customer relationship management (CRM) software. Its platform comprises productivity applications for marketing, sales, service, and operations teams. It also includes solutions for content management, commerce, and workflow automation. Those tools help businesses build long-lasting customer relationships by empowering them to provide delightful experiences at every phase of the customer journey.

HubSpot has carved out a meaningful niche in the CRM market by tailoring its products to small and medium-sized businesses, an underserved market segment. The company develops most of its software internally to ensure seamless integration rather than relying heavily on acquisitions like Salesforce. HubSpot also employs a freemium pricing model that allows users to try products without paying, then upgrade to higher-tier products as their needs evolve and their businesses grow.

HubSpot reported solid financial results in the first quarter. Its customer count increased 23% to 177,298, and the average subscription revenue per customer jumped 3%. In turn, revenue rose 27% to $502 million, and non-GAAP (adjusted) earnings soared 107% to $1.20 per diluted share. But those results are just the latest in a long line of strong financial showings from HubSpot, and investors have good reason to believe the company will maintain its momentum.

HubSpot possesses a remarkable capacity for innovation. What started as marketing software in 2006 has evolved into a full suite of CRM software, and the company is still adding new products. Content Assistant and ChatSpot.ai were launched earlier this year. The former leans on artificial intelligence (AI) to help sales and marketing teams write content for websites and ad campaigns. The latter leans on AI to help employees complete a variety of tasks, such as adding contacts to the CRM, creating department-specific reports, and drafting emails.

So what? HubSpot is already the gold standard in CRM software for small businesses, but its capacity for innovation should reinforce its leadership in that market segment while also helping the company win larger clients. With that in mind, management says its addressable market will increase from $45 billion in 2022 to $72 billion by 2027.

Shares currently trade at 14.1 times sales, a slight discount to the five-year average of 14.9 times sales. That creates a reasonable buying opportunity for patient investors.

2. Okta

Okta (OKTA -0.69%) specializes in identity and access management (IAM), a cybersecurity framework that seeks to securely connect the right people to the right applications at the right time. Its platform allows administrators to provision employees, contractors, and customers with access to corporate resources, and it leans on artificial intelligence to authenticate and authorize those users based on contexts like device, location, and behavior.

The Okta Identity Cloud is the "most comprehensive" IAM solution on the market, according to management. It addresses workforce identity and customer identity use cases, and it features the "broadest and deepest" set of pre-built integrations. Those advantages have propelled Okta to the forefront of the IAM industry. Consultancy Gartner has recognized Okta as a leader in access management for six consecutive years.

Okta delivered a solid performance in the first quarter. Customers increased by 14% to 18,050, and the average customer spent 17% more. In turn, revenue rose 25% to $518 million, and the company reported record cash from operations of $129 million, up from $19 million the prior year. More importantly, Okta is well positioned to grow its business in the years ahead.

IAM is the foundation of zero trust security, a framework that improves upon traditional perimeter-based security (e.g., corporate firewalls) by treating every user as a potential threat and every sign-on attempt as a potential breach. Zero trust security not only provides better protection but also streamlines remote and hybrid work. With that in mind, Okta values its addressable market at $80 billion.

Shares currently trade at 5.6 times sales, a big discount to the three-year average of 23.7 times sales. That's why this growth stock is worth buying right now.