All they have to do is bundle these mortgages together with safer ones and sell the resulting bundle as a security. The market will accurately assess the risk of the combined product and set prices accordingly. Because of the way this spreads out risk and incentivizes smart, objective analysis of the products, this is guaranteed to work well.
The default risk must be uncorrelated though or else you get no gains from diversification. This was a big part of how CDOs justified the security of a AAA tranche, when in reality everything was correlated because bad loans were made to everyone.