It sounds more likely to me that a backdoor was left in-place after a previous hack, than a “drive-by” attack on v2.6.5 or up. Cleaning up properly is crucial to avoid it from happening again, as such backdoors can be left dormant for a long time before rearing their ugly face again.
I’m more about prevention than cleaning up myself, and MODX LLC has vastly more experience doing cleanups (and I believe a fixed-fee model for cleanups including a guarantee, tho that might be limited to MODX Cloud), but I’d be more than happy to take a look to see if I can figure out what happened to your site and how to avoid it moving forward.
Also, I built SiteDash to help monitor and quickly upgrade sites to keep them safe. I’m also working on more security features to help detect backdoors/unexpected changes/other signs of a potential compromise. Especially if you don’t have the time or experience to constantly stay on top of sites, I’d encourage you to check it out as a second pair of eyes on your site.