Reuters was unable to verify the authenticity of the post.
The Shanghai government and police department did not respond to requests for comment on Monday.
Reuters was also unable to reach the self-proclaimed hacker, ChinaDan, but the post was widely discussed on China's Weibo and WeChat social media platforms over the weekend with many users worried it could be real.
The hashtag "data leak" was blocked on Weibo by Sunday afternoon.
Kendra Schaefer, head of tech policy research at Beijing-based consultancy Trivium China, said in a post on Twitter it was "hard to parse truth from rumour mill".
If the material the hacker claimed to have came from the Ministry of Public Security, it would be bad for "a number of reasons", Schaefer said.
"Most obviously it would be among biggest and worst breaches in history," she said.
Zhao Changpeng, CEO of Binance, said on Monday the cryptocurrency exchange had stepped up user verification processes after the exchange's threat intelligence detected the sale of records belonging to 1 billion residents of an Asian country on the dark web.
He said on Twitter that a leak could have happened due to "a bug in an Elastic Search deployment by a (government) agency", without saying if he was referring to the Shanghai police case.
He posted again on Twitter later in the day, saying: "apparently, this exploit happened because the gov developer wrote a tech blog on CSDN and accidentally included the credentials", referring to the China Software Developer Network.
Software company Elastic said it was incorrect to cite it as the source of the breach. The Shanghai government did not immediately respond to a request for comment on Wednesday.
The claim of a hack comes as China has vowed to improve protection of online user data privacy, instructing its tech giants to ensure safer storage after public complaints about mismanagement and misuse.
Last year, China passed new laws governing how personal information and data generated within its borders should be handled.