A system for controlling access to a cyber-physical system, CPS,, the system comprising: at least one electronic control unit, ECU, (1111-1113, 1121-1123, 1131-1133, 1141-1143) including at least one processor and memory operably coupled to the at least one processor; instructions that, when executed on the at least one ECU (1111-1113, 1121-1123, 1131-1133, 1141-1143), cause the at least one ECU (1111-1113, 1121-1123, 1131-1133, 1141-1143) to implement: a security tool configured to ― perform access authorization by: analyzing a plurality of messages sent through the CPS, creating a plurality of fictitious messages, the plurality of fictitious messages addressed to at least one of the ECUs (1111-1113, 1121-1123, 1131-1133, 1141-1143) to which the plurality of messages are addressed, wherein the fictitious messages consist in random commands to be used as user password characters, sending the plurality of fictitious messages through the CPS in random order and with random delay, and checking whether correct authorization data is included in the analyzed messages to determine authorized or unauthorized access to the CPS; an access monitoring tool configured to ― detect a change in at least one functional CPS module (201, 411) related to unauthorized access to the CPS, and responsive to the detection of a change in at least one functional CPS module (201, 411) related to unauthorized access to the CPS, change a state of at least one functional CPS module (201, 411) using at least one monitoring rule. at least one electronic control unit, ECU, (1111-1113, 1121-1123, 1131-1133, 1141-1143) including at least one processor and memory operably coupled to the at least one processor; instructions that, when executed on the at least one ECU (1111-1113, 1121-1123, 1131-1133, 1141-1143), cause the at least one ECU (1111-1113, 1121-1123, 1131-1133, 1141-1143) to implement: a security tool configured to ― perform access authorization by: analyzing a plurality of messages sent through the CPS, creating a plurality of fictitious messages, the plurality of fictitious messages addressed to at least one of the ECUs (1111-1113, 1121-1123, 1131-1133, 1141-1143) to which the plurality of messages are addressed, wherein the fictitious messages consist in random commands to be used as user password characters, sending the plurality of fictitious messages through the CPS in random order and with random delay, and checking whether correct authorization data is included in the analyzed messages to determine authorized or unauthorized access to the CPS; an access monitoring tool configured to ― detect a change in at least one functional CPS module (201, 411) related to unauthorized access to the CPS, and responsive to the detection of a change in at least one functional CPS module (201, 411) related to unauthorized access to the CPS, change a state of at least one functional CPS module (201, 411) using at least one monitoring rule. a security tool configured to ― perform access authorization by: analyzing a plurality of messages sent through the CPS, creating a plurality of fictitious messages, the plurality of fictitious messages addressed to at least one of the ECUs (1111-1113, 1121-1123, 1131-1133, 1141-1143) to which the plurality of messages are addressed, wherein the fictitious messages consist in random commands to be used as user password characters, sending the plurality of fictitious messages through the CPS in random order and with random delay, and checking whether correct authorization data is included in the analyzed messages to determine authorized or unauthorized access to the CPS; perform access authorization by: analyzing a plurality of messages sent through the CPS, creating a plurality of fictitious messages, the plurality of fictitious messages addressed to at least one of the ECUs (1111-1113, 1121-1123, 1131-1133, 1141-1143) to which the plurality of messages are addressed, wherein the fictitious messages consist in random commands to be used as user password characters, sending the plurality of fictitious messages through the CPS in random order and with random delay, and checking whether correct authorization data is included in the analyzed messages to determine authorized or unauthorized access to the CPS; analyzing a plurality of messages sent through the CPS, creating a plurality of fictitious messages, the plurality of fictitious messages addressed to at least one of the ECUs (1111-1113, 1121-1123, 1131-1133, 1141-1143) to which the plurality of messages are addressed, wherein the fictitious messages consist in random commands to be used as user password characters, sending the plurality of fictitious messages through the CPS in random order and with random delay, and checking whether correct authorization data is included in the analyzed messages to determine authorized or unauthorized access to the CPS; an access monitoring tool configured to ― detect a change in at least one functional CPS module (201, 411) related to unauthorized access to the CPS, and responsive to the detection of a change in at least one functional CPS module (201, 411) related to unauthorized access to the CPS, change a state of at least one functional CPS module (201, 411) using at least one monitoring rule. detect a change in at least one functional CPS module (201, 411) related to unauthorized access to the CPS, and responsive to the detection of a change in at least one functional CPS module (201, 411) related to unauthorized access to the CPS, change a state of at least one functional CPS module (201, 411) using at least one monitoring rule.