The breaches targeted security and tech data at bodies including the Japanese foreign and defence ministries.