ANSWER:

No problem, providing its shariah compliant. Do you not ride cars and use electricity? Is using it haram for this reason you had mentioned?

In order for any investment into the shares of a company, two conditions must be fulfilled:

1- The line of work is halal.

2- The company doesn’t deal in Riba by financing its activities through riba or through deposits.

https://islamqa.info/en/answers/69941/the-difference-between-shares-and-stocks

https://islamqa.info/en/answers/112445/ruling-on-buying-and-selling-shares

Is it permissible to invest in coal and oil companies, as they are doing work that is harmful to the environment and to human life.