Outright fraud in actual underlying investments like Enron or theranos is rare. Obviously it happens -- those are two examples -- but generally it's hard to pull off given the scrutiny in this country (even though republicans keep trying to reduce such scrutiny.)
Fraud by investment managers is similarly rare, though it adds another layer of such risk. It's crucial to use investment managers who are properly licensed and disclose properly and are properly audited.
Most ipos and subsequent issuances are genuinely used for proper business, but the overwhelming majority of actual trading has little to do with actual fund-raising by businesses. Of course, the business enterprise may still be quite risky and speculative even if there's no fraud. No businesses can still be a crap shoot even if the founders are sincere in their hopes.
Having said all this, the stock market is completely inappropriate for social security. Social security is meant to provide a minimum income even in (especially in) disaster scenarios. Those are exactly the scenarios that would crush a stock market. So when it really matters, it's a terrible investment.
Stock market is best to maximize expected returns over the long term. But that's not meant to be the goal of social security. The goal there is to minimize the likelihood of failing to meet the minimum payouts. Investing in the stock market actually maximizes this likelihood due to its high variance.