Wordpress may be been a security nightmare a new years ago, but has steadily gotten better with security, and, at this point has the smoothest updating process, security-minded developers, and a team that's focused on proactively identifying and fixing vulnerabilities. The same can't be said for some of its plugins though.
These days, Drupal and Joomla are the real security nightmares, because of version lock-in and very poor upgrade paths. All but the largest organizations using Drupal or Joomla tend to do so without the manpower or expertise necessary to cope with the upgrade process. They tend to use consultants and contractors to develop the functionality they need, and that functionality invariably is locked to the major version it's developed against. A few years go by, and the version they depend on reaches end of life. By which point, nobody who understands the site is left, and management frequently won't pay for code to be rewritten for the latest version. Unless you can be sure there will be adequate manpower going forward to keep maintaining and keep pace with Drupal/Joomla development, it's a ticking time bomb from day one.
Wordpress on the other hand is less of a framework and more of a ready to use system - thanks to a saner plugin system, upgrades that tend not to break the plugin architecture, and built-in functionality that does 99% of what most sites need right out of the box or with readily available plugins, has huge popularity and a large base of developers, and its rare that a Wordpress site ever becomes a dead-end project with version lock-in. Even when plugins or themes break due to upgrades, they tend to be easily removed or replaced without affecting the core CMS functionality of the site.
You are still going to see more security advisories for Wordpress these days, but at this point, that's more of a function of popularity than inherently "bad" code - it's the most widely used CMS, so of course people are constantly going to be searching for bugs - and a bug that's found is a bug that gets fixed.