As cyberattacks become more frequent, the demand for cybersecurity-related services is naturally booming. And that may be something investors can take advantage of.

One of the most direct options is to invest in an exchange-traded fund that focuses on cybersecurity. Funds that invest in providers of hardware, software, products and services in cybersecurity have continued to crop up since the first came to market in 2014.

“If you think cybersecurity is an interesting area for growth, but you don’t know which company is best positioned to take advantage of this growth, an ETF could be a good bet,” says Ben Johnson, director of global exchange-traded fund research at Morningstar.

Share Your Thoughts

Are you interested in exchange-traded funds that focus on cybersecurity? Join the conversation below.

There are caveats. Thematic funds tend to be riskier than broad market plays, and so aren’t suitable as a building block of a core portfolio, Mr. Johnson says. In addition, he says, by the time you’re seeing headlines around a particular investing theme, investor enthusiasm generally is already priced in.

Investors who own a cybersecurity ETF likely won’t need more than one, Mr. Johnson says. Roughly half of cybersecurity ETF holdings overlap, on average, which means their performances can be dramatically different. But, Mr. Johnson says, the leading stocks typically are also found in tech and growth funds, which can lead a portfolio to overconcentrate in cybersecurity.

Here is a look at a few of the cybersecurity ETFs available.

ETFMG Prime Cyber Security ETF (HACK) was the first ETF to target the cybersecurity industry and tracks the Prime Cyber Defense Index. The fund holds the shares of 59 companies and covers such subcategories as systems software, communications equipment, application software, research and consulting services.

Inception: Nov. 11, 2014

Expense ratio: 0.60%

Net assets as of June 5: $2.17 billion

One-year annualized market price return as of June 4: 32.04%

Three-year: 15.90%

Five-year: 19.20%

Top holdings as of June 5: Cisco Systems Inc., a developer and manufacturer of networking, cloud and security products, BlackBerry Ltd. , a developer of security software and services, and Proofpoint Inc., an enterprise security company.

First Trust Nasdaq Cybersecurity ETF (CIBR) seeks investment results that correspond generally to the price and yield (before fees and expenses) of its index, the Nasdaq CTA Cybersecurity Index. To be included in this fund, which consists of 40 holdings, a security must be listed on an index-eligible global stock exchange and classified as a cybersecurity company as determined by the Consumer Technology Association. For instance, each security must have a world-wide market capitalization of at least $250 million and have a minimum three-month average daily trading volume of $1 million.

Inception: July 6, 2015

Expense ratio: 0.60%

Net assets as of June 4: $3.66 billion

One-year annualized market price return as of June 4: 34.04%

Three-year: 17.90%

Five-year: 20.10%

Top holdings as of June 4: Cisco Systems, Accenture PLC, a provider of management consulting and technology services, and CrowdStrike Holdings Inc., a provider of cloud-based security technology.

Global X Cybersecurity ETF (BUG), according to its fund summary, focuses on companies that are mainly developing and managing security protocols for computer systems, software and hardware and devices. The fund, with 32 holdings, tracks the Indxx Cybersecurity Index, whose companies generate at least 50% of their revenues from cybersecurity activities.

Inception: Oct. 25, 2019

Expense ratio: 0.50%

Net assets as of June 3: $361.4 million

One-year annualized market price return as of June 4: 38.34%

Three-year: N/A

Five-year: N/A

Top holdings as of June 4: Zscaler Inc., a cloud-based information-security platform, CrowdStrike Holdings and Fortinet Inc., a developer and seller of cybersecurity solutions.

iShares Cybersecurity & Tech ETF (IHAK) seeks to track the investment results of the NYSE FactSet Global Cyber Security Index, composed of developed- and emerging-market companies involved in cybersecurity and technology, including hardware, software, products and services.

Inception: June 11, 2019

Expense ratio: 0.47%

Net assets as of June 4: $515.6 million

One-year annualized market price return as of June 4: 32.86%

Three-year: N/A

Five-year:N/A

Top holdings as of June 4: Fortinet, Proofpoint and CrowdStrike.

WisdomTree Cybersecurity Fund (WCBR) consists of the shares of 25 high-growth companies expected to drive key cybersecurity developments and innovations over the medium to long term. It seeks to track the price and yield performance, before fees and expenses, of the WisdomTree Team8 Cybersecurity Index, which focuses on seven cybersecurity themes, including cloud security capabilities, privacy and smart security solutions. Companies in the index must have a minimum market capitalization of $300 million and a minimum three-month average daily trading volume of $1 million, among other qualifications.

Inception: Jan. 28, 2021

Expense ratio: 0.45%

Net assets as of June 4: $18.8 million

One-year annualized market price return as of June 4: N/A

Three-year: N/A

Five-year: N/A

Top holdings as of June 4: Cloudflare Inc., a web infrastructure and website security company, Datadog Inc., a monitoring service for cloud-scale applications, and Rapid7 Inc., a security analytics and automation provider.

ProShares Ultra Nasdaq Cybersecurity (UCYB) seeks daily investment results, before fees and expenses, that correspond to two times the daily performance of its benchmark, the Nasdaq CTA Cybersecurity Index.

Inception: Jan. 19, 2021

Expense ratio: 0.98%

Net assets as of March 31: $2.5 million

One-year annualized market price return as of June 4: N/A

Three-year: N/A

Five-year:N/A

Ms. Winokur Munk is a writer in West Orange, N.J. She can be reached at reports@wsj.com.