The solution to all problems

You could try panacea:

a remedy for all ills or difficulties : cure-all

In context,

The law will improve the lives of local farmers, but it is no panacea.


If you are open to using something a little more idiomatic, you could try silver bullet:

: something that acts as a magical weapon; especially : one that instantly solves a long-standing problem