In a traditional economic sense, the optimal amount to spend on security measures is when the marginal costs equal the marginal benefits.
So, in that sense, coming up with a precise measure of marginal cost / marginal benefit would be hard in practice.