A method of mitigating code weaknesses in a target code by adding micro functionality fixes, comprising: at least one server external to a device, executing a code for: identifying a plurality of code weaknesses in a target code installed in a memory chip of the device, wherein the plurality of code weaknesses are selected from a group consisting of common vulnerability exposures, CVEs, and common weakness enumerations, CWEs; and sending configuration instructions to a mitigation module installed on the memory chip, the configuration instructions comprising: a plurality of micro functionality fixes, and a plurality of code weakness locations each associated with one of the plurality of code weaknesses and one of the plurality of micro functionality fixes; wherein the configuration instructions comprise a plurality of policies, each comprising at least one code statement for activating one of the plurality of micro functionality fixes; wherein at least one of the at least one code statement is a conditional statement reactive to a detection of an intrusion; wherein the micro functionality fixes provide targeted fixes per identified code weaknesses, while the target code remains unaffected, enabling fixing the code weaknesses without fixing an image of the target code directly; and wherein an execution of the mitigation module by at least one processor of the device induces an installment of the plurality of micro functionality fixes in the plurality of code weakness locations. at least one server external to a device, executing a code for: identifying a plurality of code weaknesses in a target code installed in a memory chip of the device, wherein the plurality of code weaknesses are selected from a group consisting of common vulnerability exposures, CVEs, and common weakness enumerations, CWEs; and sending configuration instructions to a mitigation module installed on the memory chip, the configuration instructions comprising: a plurality of micro functionality fixes, and a plurality of code weakness locations each associated with one of the plurality of code weaknesses and one of the plurality of micro functionality fixes; identifying a plurality of code weaknesses in a target code installed in a memory chip of the device, wherein the plurality of code weaknesses are selected from a group consisting of common vulnerability exposures, CVEs, and common weakness enumerations, CWEs; and sending configuration instructions to a mitigation module installed on the memory chip, the configuration instructions comprising: a plurality of micro functionality fixes, and a plurality of code weakness locations each associated with one of the plurality of code weaknesses and one of the plurality of micro functionality fixes; wherein the configuration instructions comprise a plurality of policies, each comprising at least one code statement for activating one of the plurality of micro functionality fixes; wherein at least one of the at least one code statement is a conditional statement reactive to a detection of an intrusion; wherein the micro functionality fixes provide targeted fixes per identified code weaknesses, while the target code remains unaffected, enabling fixing the code weaknesses without fixing an image of the target code directly; and wherein an execution of the mitigation module by at least one processor of the device induces an installment of the plurality of micro functionality fixes in the plurality of code weakness locations.