Stocks, yes - you are allowed to passively invest here without violating the terms of your H-1B.
Real estate is somewhat less clear at least in the sense of buying and selling individual properties at auction, simply because this would I think require some measure of active management if not direct labor by you. If you plan to hold for a while and flip for a profit, the property will need to at least be maintained if not improved - either by yourself or by someone with whom you contract (thereby engaging in management-level decision-making). Either way, this might be viewed as productive work violative of the terms of your H-1B - even if you are not receiving any payment for this work. There are opinions out there saying that this is perfectly fine, but to me there are factors involved beyond buying and selling a simple equity, and this makes the answer less difinitive.
Tax lien investing, on the other hand, is akin to investing in securities - little involvement would be required beyond buying and selling, is this would therefore be acceptable under the terms of your H-1B.
Good luck in your ventures.