BEIJING — Chinese state television has broadcast footage of what two experts on the Chinese military say appears to be a military institute demonstrating software designed to attack websites in the U.S.

Although it could be a decade old or a mock-up, the 10-second segment—part of a longer report on cybersecurity—appears to be a rare example of an official source contradicting China'a repeated assertions that it doesn't engage in cyberattacks, according to Andrew Erickson and Gabe Collins of the China SignPost analytical service,...