This study proposes an innovative approach specifically devised for discriminating faults and replay attacks in the context of hybrid system, significantly advancing cyber-physical system security.At the core of our method is the intricate process of embedding distinct series of non-recurring alphanumeric codes in each cell of the output matrix.This advanced encoding strategy is essential for the accurate identification of replay attacks, as it allows for the detailed analysis of code pattern variations that are indicative of malicious activities.Our approach is uniquely effective in revealing subtle anomalies and replicated data patterns, marking a substantial enhancement in the detection of sophisticated cyber threats.Complementing this is the implementation of a Sliding Mode Observer for precise fault detection, enabling our system to simultaneously differentiate between faults and replay attacks.This dual detection strategy is thoroughly demonstrated in complex system scenarios, highlighting its effectiveness as a robust defense mechanism.The introduction of this innovative method represents a significant step forward in fortifying the security and integrity of modern hybrid systems.A four-tank hybrid system is considered as a case study, to show the effectiveness of the proposed approach in identifying and countering faults and replay attacks within the system.