Yahoo raked in more than $5 billion from selling part of its holdings in the recent Alibaba IPO and now aims to invest some of that cash into the hip messaging startup Snapchat.

Snapchat has nearly finalized a $20 million round of financing led by Kleiner Perkins, and the Wall Street Journal's sources indicate that Yahoo was involved in the discussions but was just one of many potential investors.

Yahoo CEO Marissa Mayer has committed to returning at least half of that $5 billion windfall to shareholders, leaving questions about what to do with the rest. An investment in the unmonetized Snapchat at a $10 billion valuation, while risky, may prove to be quite savvy as Snapchat gears up to debut a service for disappearing news stories and ads for its 100 million users, and Yahoo's business is all about content distribution.

This new round of funding would make Snapchat one of the most highly valued startups in the world.