There are different things you can buy/sell in stock market.
One of them is called stock certificate. This one is theoretically permitted to buy/sell, for that it means the ownership of a specific share of stock in a corporation.
The other financial products and all types of bonds (public or private) are not permitted, as for all of them include interest based income.
The problem is:
Stock markets today are too open for speculative augmentations/reductions of value. Stock markets are generally come under false and misleading fluctuation of prices which are run by either the most powerful several corporations or brokerage firms operating in that country. That’s why most of the scholars consider buying/selling in stock markets as not permitted and not lawful.