SEO and Security: The Pharma Hack
Ever heard of the pharma hack? Or The Japanese Keyword Hack? They're both broadly the same thing and both affect wordpress sites, and due to the nature of the internet there's probably like 100 different variations of it every single day.
So what is it? Short version: it's a way for unscrupulous folks to hijack sites with decent equity in order to point links at the usual low quality pharma/gambling/porn sites. The way they get in varies, but it's usually through a vulnerable and/or unmaintained plugin on a wordpress site, and it allows them to do something like this:

The problem is, when you click on the urls listed, either the content will look just fine, or the page will simply return a 404 status. Why? Because the site is now changing the content it serves based on User Agent
What is a User Agent Please?
Simply put, a User Agent is a namebadge slapped on the front of every request made by a device. it's a way of self-declaring who or what you are, so the server receiving the request can decide how to respond.
Obviously, Googlebot has its own User Agent (Multiple in fact), and every single request that Google makes to your website features the above in its headers.
This means, of course, that you now have a mechanism for serving one type of content to users, and something totally different to Search Engines, like this:.

The most egregious of these hacks will automagically spin up hundreds or thousands of pages on your domain, each full of links and content when Google visits it, but likely non-existent when visited by a human being.
And this is the frightening bit! If the hack doesn't mess with any of your landing pages, it can be very difficult to spot this - you're essentially having to look for something that you don't know exists, written in a language (and script) you might not speak, and without any idea what the content might be even if you do speak it.
However, Some of these hacks will actually alter currently extant pages, likely running the risk of being caught and scrubbed in return for the equity from a link places on a bigger page, and that's usually where you'll spot it, because the SERPs you are monitoring become materially different.
But where else can you spot this stuff?
Easy: Everyone's favourite tool: Search Console, or your crawler of choice.
Search Console
Search Console is a good way of finding this stuff, but the problem you have with it is that finding these issues via SC is that by the time you find them, Google already knows about them.
The way to spot this in SC is pretty simple: Do your due dilligence and investigate spikes in crawled/discovered urls, look in your crawl activity reports, and take note of any urls that seem unusual or are in scripts that you might not recognise.
You could also use the live inspection tool, but Google changed the inspection tool's User Agent recently so that it no longer exactly matches the "real" Googlebot UA, and smart hackers will know and take advantage of that.
You might also just get SC straight up telling you they believe you've been hacked, which is useful but as an SEO you probably don't want this.
Crawlers
Dead easy: Dig out your crawler of choice, find the "change user agent" setting, and change it to Googlebot (You can copy and paste the User Agent String from the link above if you need to).
Then, fire a crawl off and wait. See if any urls show up that you don't recognise, see if any content seems unusual, all the usual stuff.
So How Do I Fix It?
Here's my rubbish response: If you work for a business where you aren't also part of the dev/security team, raise an urgent ticket. If it's your site, or you are the only person responsible for it, then do a little Googling - this resource is a fairly indepth explanation of what to do.
How Worried Should I Be?
If you don't have a wordpress site, probably not very. Attacks with similar symptoms could always happen to your site, but the "off the shelf" nature of WP means that these sites get hit more often than anything else.
If you DO have a WP site, make sure it (and probably more importantly, its plugins) are kept up-to-date with the newest security patches.
If you do get hit, the SEO damage done sort of varies by how long it's there for and how deep its tendrils have spread.
Obviously, if your homepage is suddenly showing titles and descriptions that suggest that your B2B SAAS is now a dodgy viagra reseller, not only will those pages begin to lose relevance for the space you're operating in, anyone who sees that page in the SERPs isn't going to trust you with their data - afterall, you have obviously and clearly been hacked, and this is almost worse. SEO metrics can be regained, but the trust of existing and potential customers is significantly harder to win back - it doesn't necessarily matter that it was "only" your marketing blog that got hit via an out of date image compression plugin - your reputation is likely now stained for a very long time.
However, if you catch the issue before the above happens, there's probably going to be little issue once you've thoroughly wiped the problem form the site. These attacks are normally pretty "hit and run", and quite often they take advantage of vulnerabilities that don't need login details etc etc - although obviously I would recommend changing them all just in case.