Business has been booming recently for cybersecurity companies due to the surge of devastating data breaches worldwide. CyberArk Software (CYBR 1.84%) and Palo Alto Networks (PANW 0.11%), two closely watched stocks in that sector, have respectively rallied 74% and 87% over the past 12 months, compared to the S&P 500's flat growth. Let's check out both stocks to see if either is still worth buying.

Source: Pixabay.

How CyberArk and Palo Alto make money
CyberArk's cybersecurity solutions locate internal threats that have breached an organization's initial layer of security. Its software isolates a threat, locks down the compromised network or computer, and blocks it from spreading or stealing important data. CyberArk's core focus is protecting privileged accounts, which are often exploited by cybercriminals to gain access to sensitive data. This is a unique strategy among cybersecurity firms, which generally focus on blocking or preventing external attacks.

Palo Alto Networks' core product is a firewall that shields businesses from data breaches. During NSS Labs' 2015 NGIPS (Next-Generation Intrusion Prevention System Test), its firewall achieved the highest security efficacy ratings against comparable peers when exposed to real-time "drive-by" exploits. Since Palo Alto and CyberArk focus on two different markets, the two companies should be considered complementary peers instead of direct rivals.

Top-line growth
CyberArk's revenue is split into two main categories: licenses and maintenance. Last quarter, license revenue soared 100% annually and accounted for 61% of its top line. The remainder consisted of maintenance and service revenues, which climbed 38%.

CyberArk's revenue growth looks strong, but there are concerns that its growth could peak early. Its second-quarter revenue growth of 70% represents a decline from 89% growth in the first quarter and 81% growth in the fourth quarter of 2014. CyberArk's revenues in the second quarter were less than a sixth of Palo Alto's in its most recent quarter, but Palo Alto posted much higher sales growth back when it generated comparable revenues.

Meanwhile, Palo Alto's growth continues to accelerate. Its revenues rose 55% annually last quarter, versus 54% growth in the second quarter and 50% growth in the first quarter. Palo Alto's products revenue rose 44% last quarter, as services revenue climbed 69%.

Bottom-line growth
CyberArk's slowing sales growth might cause investors to question how large the company can actually become, but its bottom line tells a different story. Unlike most of its industry peers, CyberArk is profitable. Last quarter, its GAAP net income rose over 300% annually to $4.9 million. That translated to earnings of $0.14 per share, up from a loss of a penny per share a year earlier.

In its most recent quarter, Palo Alto reported a GAAP net loss of $45.9 million, or $0.56 per share, which was lower than its loss of $147 million, or $1.96 per share, a year earlier. The reason that CyberArk can squeeze out a strong profit on much less revenue than Palo Alto is simple -- it spends more conservatively. Over the past 12 months, 77% of CyberArk's revenue was spent on total expenses, versus 115% for Palo Alto.

Since CyberArk can growth its top and bottom lines with manageable expenses, its growth might accelerate considerably if it boosts spending. Palo Alto doesn't have as much room to increase expenses, and it's still generating lower profits at a higher cost than CyberArk.

Valuations and expectations
CyberArk and Palo Alto Networks definitely aren't cheap stocks. CyberArk trades at 105 times trailing earnings, 65 times forward earnings, and 12 times sales. Palo Alto trades at nearly 100 times forward earnings and 16 times sales. By comparison, the S&P 500 currently has a P/E of 20 and a P/S of 1.7. Stocks with high multiples often slip during market downturns, so neither stock is for risk averse investors.

Analysts still expect CyberArk and Palo Alto's revenues to respectively rise over 40% and 50% the fiscal year, although that growth is expected to cool off slightly next year.

The key takeaway
However, overall demand won't dry up anytime soon, since the costs of data breaches worldwide could nearly quadruple to $2.1 trillion between 2015 and 2019, according to Juniper Research. Therefore, investors might want to consider keeping one or two cybersecurity pure-play stocks in their long-term portfolio.

I think CyberArk and Palo Alto are both solid stocks, but I prefer CyberArk for three reasons: It's smaller, it's profitable, and it has a comfortable niche market. In my opinion, concerns about CyberArk's growth potential are overblown, since it has room to boost spending and buy up competitors, introduce new products, or expand into new markets in the near future.