Image Source: Getty Images.

Investing in stocks is one of the best ways to build lasting, long-term wealth. Cases can be made for achieving wealth through real estate or the creation and ownership of private businesses, but few asset classes have a track record of wealth creation as solid as public stock ownership, especially on a real (inflation-adjusted) basis. 

Image Source: Ibbotson Associates.

That said, investing can be wrought with peril if care isn't taken to avoid the most dangerous aspects of the market, including the two below.

Penny stocks

The allure of penny stocks has been felt by many an investor, particularly those who are just beginning their investing journeys. Who wouldn't be tempted by the possibility of earning multiple times your money if a stock can only approach $1 per share -- especially when the downside appears so limited?

How much further could a stock fall if it's already trading for just a few cents per share? The answer -- unfortunately for many wounded penny-stock investors -- is $0. That's because, while a penny stock may appear inexpensive because of its low per-share price, the businesses they represent are often of poor quality. In turn, many go bankrupt, which can lead to a complete, 100% loss of capital for investors.

Worse still, the penny-stock realm is an opaque world filled with fraudsters and scam artists. Pump-and-dump schemes are prevalent, whereby hucksters artificially ramp up a stock's price through shady email and direct-mail promotional campaigns that make dubious claims about the business, and even via illegal practices such as spreading false rumors. Then, as the penny-stock's price surges as a result of these actions, the pumpers unload their shares into unsuspecting investors' hands, who often suffer gruesome losses as the stock plummets to its original price level -- and sometimes much lower.

For these reasons, penny stocks can be hazardous to your wealth. The prudent move for the great majority of investors is to simply steer clear of them.

Using margin

Buying stocks on margin allows investors to purchase more shares than they otherwise could have if they paid for those stocks in full with cash. By borrowing money from their brokerages, investors are able to leverage their investment capital.

There are, of course, costs associated with the use of margin. Brokerages charge interest on the borrowed funds, so investors need to earn returns above the cost of this interest to generate a profit.

More dangerous is the fact that leverage is a double-edged sword. While it's true that investors can magnify their gains by using margin when their stocks are rising in value, the reverse is also true. For example, investors using 50% margin -- e.g. depositing $10,000 in a margin account to purchase $20,000 worth of stocks -- obtain two times leverage on their investments. But these same investors would be completely wiped out if the stocks in their portfolios fell by 50% in value -- something that occurred to many stocks just a few years ago during the financial crisis.

Worse still is that, even if stocks rebound prior to these investors suffering a total loss, many won't have the opportunity to hold onto their stocks to benefit from the recovery. That's because there are maintenance margin requirements that demand investors maintain adequate collateral to support their margin loans.

If investors cannot contribute additional funds to satisfy these requirements when their stocks decline below certain levels, brokerages will sell their shares in order to meet the maintenance requirements. In this way, investors who use margin are often forced to sell at the worst possible times -- when their individual stocks are at their lows and during the depths of overall market declines.

All told, the dangers of margin may be best explained by the words of legendary investor Warren Buffett:

Stay away from leverage. A long, long time ago a friend said to me about leverage, 'If you're smart you don't need it. If you're dumb you got no business using it.'

Sage advice, indeed.