The U.S. economy has been spared a post-pandemic recession so far, but that may not remain true forever. Inflation remains peskily high, and all signs point to higher interest rates for a longer time. Add in the return of student-loan payments and dwindling household savings, and you have a recipe for an unpredictable economic environment.

Few companies are entirely immune from recessions, but some will hold up better than others. Cybersecurity provider CrowdStrike (CRWD 2.11%) and tech giant International Business Machines (IBM 0.74%) will certainly feel some pain, but they're capable of performing well against a tough economic backdrop.

CrowdStrike

When economic uncertainty looms, businesses often start looking for ways to cut costs. One line item that is unlikely to be anywhere near the top of the list is cybersecurity. The potential cost of phoning it in is just too high.

The average total cost of a data breach in 2023 reached an all-time high of $4.45 million, according to a report from IBM. The potential cost savings from taking proactive steps are significant. Companies that adopt security testing within the software-development process cut the average cost of a breach by $1.68 million. There was also a strong correlation between security complexity and data-breach costs. The more convoluted a company's security systems are, the costlier breaches tend to be.

CrowdStrike and its Falcon platform aim to be a one-stop cybersecurity shop for modern businesses making heavy use of cloud computing. The company's AI-powered Threat Graph churns through trillions of signals each week, getting smarter and more capable as time goes on. Customers can adopt any number of modules, with each providing a key piece of functionality.

The power of CrowdStrike's business model is its ability to increase customer spending over time. A full 63% of subscription customers now use at least five modules, and 24% use at least seven modules. Even as other enterprise-facing software companies have faced slowdowns this year, CrowdStrike continues to grow swiftly. Revenue soared 37% year over year in the second quarter, and the company's dollar-based net-retention rate is hovering right around its target of 120%.

CrowdStrike won't be completely immune from tough economic conditions. While cybersecurity spending is unlikely to be slashed right away, any company facing a dire outlook will be forced to make difficult choices to bring costs down. But compared to other types of enterprise-software providers, CrowdStrike should hold up better than most.

One thing to note is that CrowdStrike stock is expensive. With a market capitalization near $40 billion, the stock trades for around 13 times forward sales and more than 50 times forward-adjusted earnings. This sky-high valuation leaves little room for error.

CrowdStrike stock may be volatile, but the company is well positioned to continue to grow regardless of the economic backdrop.

International Business Machines

IBM is not a fast-growing company. The tech giant expects to grow revenue by between 3% and 5% this year after adjusting for currency. Its fortunes are partly tied to global IT spending, which can ebb and flow with the global economy.

IBM sells software, hardware, and consulting services, but there's a common thread running through all those businesses. Clients look to IBM to help them save money, boost productivity, and eke out efficiencies. While demand for some types of products and services will falter as economic conditions deteriorate, demand for others will rise as customers focus on doing more with less.

IBM's hybrid cloud-computing effort, which spans all its segments and is anchored by Red Hat's software platform, is a great example. Companies move to the cloud to save money, simplify operations, and make deploying and iterating faster and easier. For any big organization with a sprawling IT infrastructure, any kind of digital-transformation project is complex. IBM's consulting arm provides guidance and know-how, and its software arm provides the underlying platform. IBM isn't selling a service; it's selling a solid return on investment through lower costs or improved productivity.

In Q2, IBM noted that demand for discretionary projects from clients was waning, particularly in the U.S. However, demand for large transformation projects that had clear and well-defined benefits for clients remained strong. The net result was solid revenue growth and expanding profit margins. IBM expects its free cash flow to expand by about $1 billion to $10.5 billion this year despite an uncertain economic environment.

Like CrowdStrike, IBM is not immune from a severe downturn. But in a mild recession where companies are still willing to invest in big tech projects aimed at reducing costs, IBM should do just fine. The stock is not particularly expensive, trading for just 12 times free-cash-flow guidance. For investors with some patience, buying and holding looks like a good move.