The attack allowed hackers to gain access to nine federal agencies and their internal email systems. At least 100 private companies were also affected. The Treasury documents said cybersecurity staffing shortages hindered the department’s ability to detect the intrusion.