US agencies hacked in monthslong global cyberspying campaign