You say that losses are reduced by investment, so we can write the (private) loss as a function of own investment and others' investment: $l^i(c^i,\mathbf{c}^{-i})$ with $l^i_1(c_i,,\mathbf{c}^{-i})<0$.
Player $i$'s utility is $U^i(c^i,\mathbf{c}^{-i})=-f(l^i(c^i,\mathbf{c}^{-i}))-c^i$ and he invests until the first-order condition is satisfied:
$$-f'[l^i(c^i,\mathbf{c}^{-i})]l^i_1(c^i,\mathbf{c}^{-i})-1=0.$$
The social loss is
$$\sum_i\left[-f_i(l^i(c^i,\mathbf{c}^{-i}))-c_i\right]$$
so that the first-order condition for the optimal $c^i$ is
$$-f'[l^i(c^i,\mathbf{c}^{-i})]l^i_1(c^i,\mathbf{c}^{-i})-\left[\sum_{j\neq i}f'[l^j(c^j,\mathbf{c}^{-j})]\frac{\partial}{\partial c^i}l^j(c^j,\mathbf{c}^{-j})\right]-1=0.$$
This now looks like a standard externality model, where the external benefit of $i$'s investment is
$$b^i(\mathbf{c}^{-i})=-\sum_{j\neq i}f'[l^j(c^j,\mathbf{c}^{-j})]\frac{\partial}{\partial c^i}l^j(c^j,\mathbf{c}^{-j})>0.$$
If $l^i(\cdot)$ are publicly known then the problem can easily be solved as by imposing upon $i$ a standard Pigouvian subsidy of $b^i(\mathbf{c}^{-i})$ per unit of investment. This means that $i$'s payoff (including the subsidy) when $j\neq i$ choose $\mathbf{c}^{-i}$ is
$$\underbrace{-f(l^i(c^i,\mathbf{c}^{-i}))-c^i}_{U^i(c^i,\mathbf{c}^{-i})}+b^i(\mathbf{c}^{-i})c^i.$$
A rational $i$ will maximise this subsidy-augmented payoff; his first order condition is
$$-f'[l^i(c^i,\mathbf{c}^{-i})]l^i_1(c^i,\mathbf{c}^{-i})\underbrace{-\left[\sum_{j\neq i}f'[l^j(c^j,\mathbf{c}^{-j})]\frac{\partial}{\partial c^i}l^j(c^j,c^{-j})\right]}_{b^i(\mathbf{c}^{-i})}-1=0,$$
which is exactly the same as the first-order condition used to maximise social welfare. It is therefore a Nash equilibrium for each $i$ to choose the socially efficient level of investment given that everyone else does the same.
If the $l$s are heterogeneous and private information then things get more complicated because we have to get people to reveal their private information. Assume there is a benevolent central planner with the power to monitor agents' investments. One way to do this is then, indeed, to use a VCG mechanism. It would work like this: first, the central planner asks each agent to report their $l^i(\cdot)$. Write $\widetilde{l}^i$ for the reports. He then solves the first-order condition for the maximum of social welfare given the (possibly dishonest) reports. Thus, he maximises
$$\widetilde{W}(\widetilde{\mathbf{l}},\mathbf{c})=\sum_i\left[-f_i(\widetilde{l}^i(c^i,\mathbf{c}^{-i}))-c_i\right].$$
Next the planner instructs all players to invest up to the optimal level. In return, he promises to pay to each $i$ a subsidy equal to
$$S^i=\max_{\mathbf{c}^{-i}}\left[\widetilde{W}(\widetilde{\mathbf{l}},\mathbf{c})-(-f(\widetilde{l}^i(c^i,\mathbf{c}^{-i}))-c^i)|c^i\right]-\max_{\mathbf{c^{-i}}}\left[\widetilde{W}(\widetilde{\mathbf{l}},c^1,\ldots,c^{i-1},0,c^{i+1},\ldots,c^n)-(-f(\widetilde{l}^i(0,\mathbf{c}^{-i})))\right].$$
Woah, what is that ugly thing!? The first set of square brackets is the welfare everyone other than $i$ gets. The second is the welfare everyone other than $i$ would get if $i$ were to drop out of the market all together. Thus, the difference between the two is $i$'s positive externality on everyone else.
Now let's look at $i$'s payoff:
$$U^i=S^i-f(\widetilde{l}^i(c^i,\mathbf{c}^{-i}))-c^i$$
When evaluated at the equilibrium $\mathbf{c}^{-i}$ some terms cancel and we have
$$U^i=\max_{\mathbf{c}^{-i}}\left[\widetilde{W}(\widetilde{\mathbf{l}},\mathbf{c})|c^i\right]-\max_{\mathbf{c}^{-i}}\left[\widetilde{W}(\widetilde{\mathbf{l}},c^1,\ldots,c^{i-1},0,c^{i+1},\ldots,c^n)-(-f(\widetilde{l}^i(0,\mathbf{c}^{-i})))\right]$$
The second square bracket here does not depend on $c^i$ (remember, it is the surplus if $i$ were to drop out of the market) so $i$'s problem collapses to choosing $c^i$ to maximise $\max_{\mathbf{c}^{-i}}\left[\widetilde{W}(\widetilde{\mathbf{l}},\mathbf{c})|c^i\right]$. Thus, $i$ has the right incentive to choose $c^i$ to maximise social welfare with respect to the reported $l$s.
What about the incentive to report $l$ honestly? The social planner is going to chose the optimal $c$s to maximise
$$\widetilde{W}(\widetilde{\mathbf{l}},\mathbf{c})=\left[\widetilde{W}(\widetilde{\mathbf{l}},\mathbf{c})-(-f(\widetilde{l}^i(c^i,\mathbf{c}^{-i}))-c^i)\right]+(-f(\widetilde{l}^i(c^i,\mathbf{c}^{-i}))-c^i)$$
(this is just $\widetilde{W}$ with $i$'s utility added on and then subtracted again). $i$ would like to maximise
$$U^i=S^i+(-f(l^i(c^i,\mathbf{c}^{-i}))-c^i)$$
which is
$$U^i=\underbrace{\left[\widetilde{W}(\widetilde{\mathbf{l}},\mathbf{c})-(-f(\widetilde{l}^i(c^i,\mathbf{c}^{-i}))-c^i)\right]+z}_{S^i}+(-f(l^i(c^i,\mathbf{c}^{-i}))-c^i)$$
where $z$ is the second term in $S^i$ (does not depend on $\widetilde{l}^i$). Thus we see that the social planner's choice will coincide with $i$'s optimum exactly when $l^i=\widetilde{l}^i$ so that $i$ has an incentive to report $l^i$ truthfully.