There are halakhic authorities who absolve the average shareholder of any responsibility for the actions of the companies whose shares he owns. The ultimate basis of the lenient position is the perception of the investor not as an owner, but rather as a creditor.
Stock purchasers lend money to the company in return for a note – the stock certificate – which promises distributions of profits which are a kind of interest payment. The assets of the company are collateral on the loan.
To a large extent, this gets the investor “off the hook;” after all, there is no general prohibition of lending money to individuals who may use it for purposes which would be forbidden to the lender himself.