We present a type system to analyze authentication protocols in the presence of compromised principles. The main feature of our analysis method is that it is based on a minimal set of hypothesis and test protocols for a strong authentication requirement, called an injection agreement. The set of compromised principles can grow dynamically and there is no limit to the type of nonce hook used in the protocol. We also present and implement a type reconstruction algorithm that automates analysis in the sense that only a very high specification of protocol and security requirements is required. The security property that is analyzed is an injectable agreement. The implemented type reconstruction algorithm automates the analysis. We present a type-based approach to the analysis of authentication protocols. Every principle can be compromised at any time. We are proving that the method of analysis proposed in this document is sound.