A system for inhibiting attacks on embedded devices (110, 112, 114), the system comprising a processor configured to; identify an embedded device (110, 112, 114) that is configured to provide one or more services to one or more digital processing devices (102, 104, 106) within a communications network; receive a first firmware associated with the embedded device (110, 112, 114); generate a second firmware that is functionally equivalent to the first firmware by: determining unused code within the first firmware; removing the determined unused code to create free memory locations within the second firmware; using the free memory locations to restructure remaining program instructions from the first firmware into memory positions within the second firmware and insert a manager and at least one payload that includes one or more program instructions for providing defensive capabilities to the embedded device (110, 112, 114); and injecting control-flow intercepts pointing to the manager; and inject the second firmware into the embedded device (110, 112, 114), wherein the second firmware is configured to: inject the at least one payload into the embedded device (110, 112, 114); wherein the manager is configured to perform context management functions so as to store a system execution context on the embedded device (110, 112, 114); determine a time period for executing the at least one payload based at least in part on processing resources associated with the embedded device (110, 112, 114); execute the at least one payload for the time period; store a payload execution context of the at least one payload in response to the determining that the time period has elapsed; and load the system execution context to continue operation of the embedded device (110, 112, 114). determining unused code within the first firmware; removing the determined unused code to create free memory locations within the second firmware; using the free memory locations to restructure remaining program instructions from the first firmware into memory positions within the second firmware and insert a manager and at least one payload that includes one or more program instructions for providing defensive capabilities to the embedded device (110, 112, 114); and injecting control-flow intercepts pointing to the manager; and inject the second firmware into the embedded device (110, 112, 114), wherein the second firmware is configured to: inject the at least one payload into the embedded device (110, 112, 114); wherein the manager is configured to perform context management functions so as to store a system execution context on the embedded device (110, 112, 114); determine a time period for executing the at least one payload based at least in part on processing resources associated with the embedded device (110, 112, 114); execute the at least one payload for the time period; store a payload execution context of the at least one payload in response to the determining that the time period has elapsed; and load the system execution context to continue operation of the embedded device (110, 112, 114). inject the at least one payload into the embedded device (110, 112, 114); wherein the manager is configured to perform context management functions so as to store a system execution context on the embedded device (110, 112, 114); determine a time period for executing the at least one payload based at least in part on processing resources associated with the embedded device (110, 112, 114); execute the at least one payload for the time period; store a payload execution context of the at least one payload in response to the determining that the time period has elapsed; and load the system execution context to continue operation of the embedded device (110, 112, 114).