For S7-300 CPUs (specifically MMC cards), Siemens allows a total reset, but it comes with a catch: You will lose the user program.
If you have legal ownership of the machine but lack the password, consider these industry-standard approaches:
This blog post explores the utility, risks, and ethical considerations surrounding the "unlock s7-300.exe" tool, commonly used for recovering passwords on legacy Siemens S7-300 PLCs. What is Unlock S7-300.exe?
SIEMENS Simatic S7-300 (pre-2009 versions) Default Password, How To