Shares of Countrywide Financial shot up more than 50 percent on Thursday after a report that Bank of America may buy the troubled leading U.S. mortgage lender.

The reported pending talks, come amid rumors earlier this week that Countrywide needed cash to avoid bankruptcy, speculation that the company denied. The Wall Street Journal first reported the story.

Details of an agreement are still being worked out and there is a chance that the talks could fall apart, the Wall Street Journal reported.

Countrywide shares rose $2.64, or 51.56 percent to $7.76. Bank of America shares rose 56 cents, or 1.45 percent to $39.30.

Bank of America has a market value of $174.43 billion while Countrywide is worth about $4.49 billion. The mortgage lender's value was at about $26 billion earlier this year.

In August, Bank of America bought about $2 million in preferred shares from Countrywide, which at the time was worth about 16 percent of the company.

Calabasas, California-based Countrywide has been an independent company since 1969.