China needs to tackle its corporate debt problem before it spirals out of control.

That's the message from the International Monetary Fund, which warned China about its debt levels on Friday.

"China's medium term outlook is clouding because of high and rising corporate debt," said James Daniel, IMF's mission chief in China. He said the world's second biggest economy must "urgently address the problem."

At $25 trillion, China's debt stands at about 254% of GDP, according to data from the Bank for International Settlements. Even though that's high, it's actually pretty close to some other indebted countries in the world.

Related: China is crushing the U.S. in 'economic warfare'

The U.S., for example, has similar levels of debt as China. What's alarming about China's mountain of debt is the speed at which it's been growing in recent years. It has quadrupled between 2007 and 2014, according to a report by McKinsey.

It has also spooked many global institutions and investors.

"Investors are right to be worried: dealing with the unsustainable build-up of debt is one of the biggest long-run challenges that policymakers face," said Julian Evans-Pritchard, China economist at Capital Economics.

Related: China's sluggish economy continues to drag

The massive lending spree was designed to provide a shot in the arm to China's slowing economic growth after the financial crisis. That's not necessarily a bad thing -- governments around the world encourage companies to borrow in order to invest and build to keep the economic engines spinning.

But Evans-Pritchard said the trouble with China is that the credit is often poorly allocated, generating much weaker economic returns.

Rating agencies and international economic organizations have long warned China about the rising level of debt, especially among stalling state owned companies. The IMF said Friday, China should tackle this "zombie" debt problem and write off bad loans and recognize losses.

Related: S&P warns of increasing risks in China

China is starting to get tougher with some of its state-owned heavy industry giants. Beijing announced earlier this year that it would cut 1.8 million coal and steel jobs and invest 100 billion yuan ($15.3 billion) in restructuring and training to find new employment for the laid off workers.

But the IMF said China needs to broaden this effort to other industries and focus on more productive and innovative parts of the economy.