McKinsey has rushed to fix flaws in its in-house AI systems after hackers gained access to millions of its internal messages and were able to identify sensitive files.