Search in sources :

Example 11 with ComponentInstance

use of verdict.vdm.vdm_model.ComponentInstance in project VERDICT by ge-high-assurance.

the class Instrumentor method networkInjection.

// NI:
// - Select all channels ch in the model M such that:
// ch.ConnectionType = Remote & ch.Connection-Encrypted = False &
// ch.Connection-Authentication = False
// 
// - Select all channels ch in CH such that:
// (ch.start.insideTrustedBoundary = false and ch.connectionType = Remote)
// and ((ch.deviceAuthentication = 0 and ch.sessionAuthenticity = 0) or
// ch.start.strongCryptoAlgorithms = 0)
@Override
public void networkInjection(HashSet<Connection> vdm_links) {
    try {
        HashSet<String> links = new HashSet<String>();
        BlockImpl blockImpl = null;
        for (ComponentImpl componentImpl : vdm_model.getComponentImpl()) {
            blockImpl = componentImpl.getBlockImpl();
            // BlockImpl
            if (blockImpl != null) {
                // Selection channels (Authentication = OFF & DataEncrypted = OFF)
                for (Connection connection : blockImpl.getConnection()) {
                    boolean insideTrustedBoundary;
                    int strongCryptoAlgorithms;
                    if (connection.getSource().getSubcomponentPort() != null) {
                        ComponentInstance sourceComponent = connection.getSource().getSubcomponentPort().getSubcomponent();
                        List<GenericAttribute> sourceComponentAttributeList = sourceComponent.getAttribute();
                        GenericAttribute insideTrustedBoundaryAttribute = getAttributeByName(sourceComponentAttributeList, "InsideTrustedBoundary", sourceComponent.getName());
                        GenericAttribute strongCryptoAlgorithmsAttribute = getAttributeByName(sourceComponentAttributeList, "StrongCryptoAlgorithms", sourceComponent.getName());
                        insideTrustedBoundary = Boolean.parseBoolean(insideTrustedBoundaryAttribute.getValue().toString());
                        strongCryptoAlgorithms = Integer.parseInt(strongCryptoAlgorithmsAttribute.getValue().toString());
                    } else {
                        insideTrustedBoundary = true;
                        strongCryptoAlgorithms = 1;
                    }
                    List<GenericAttribute> connectionAttributeList = connection.getAttribute();
                    GenericAttribute connectionTypeAttribute = getAttributeByName(connectionAttributeList, "ConnectionType", connection.getName());
                    GenericAttribute deviceAuthenticationAttribute = getAttributeByName(connectionAttributeList, "DeviceAuthentication", connection.getName());
                    GenericAttribute sessionAuthenticityAttribute = getAttributeByName(connectionAttributeList, "SessionAuthenticity", connection.getName());
                    String connectionType = connectionTypeAttribute.getValue().toString().toLowerCase();
                    int deviceAuthentication = Integer.parseInt(deviceAuthenticationAttribute.getValue().toString());
                    int sessionAuthenticity = Integer.parseInt(sessionAuthenticityAttribute.getValue().toString());
                    if ((!insideTrustedBoundary || connectionType.equalsIgnoreCase("untrusted")) && ((deviceAuthentication == 0 && sessionAuthenticity == 0) || strongCryptoAlgorithms == 0)) {
                        vdm_links.add(connection);
                        links.add(connection.getName());
                    }
                }
            }
        }
        for (Connection con : vdm_links) {
            if (!isProbePort(con)) {
                links.addAll(get_ports(con));
            }
        }
        this.attack_cmp_link_map.put("NI", links);
    } catch (CRVException e) {
        System.out.println("\tCRV Error " + e.getCode() + " " + e.getMessage());
    }
}
Also used : BlockImpl(verdict.vdm.vdm_model.BlockImpl) Connection(verdict.vdm.vdm_model.Connection) ComponentInstance(verdict.vdm.vdm_model.ComponentInstance) GenericAttribute(verdict.vdm.vdm_data.GenericAttribute) ComponentImpl(verdict.vdm.vdm_model.ComponentImpl) HashSet(java.util.HashSet)

Example 12 with ComponentInstance

use of verdict.vdm.vdm_model.ComponentInstance in project VERDICT by ge-high-assurance.

the class Instrumentor method outsiderThreat.

// OT
// - Select all components c in C such that:
// c.componentType is in {Human, SwHumanHybrid, Hybrid, HwHumanHybrid}
// and c.insideTrustBoundary = false and c.physicalAccessControl = 0
// and (c.logging = 0 and (c.systemAccessControl = 0 and c.userAuthentication = 0))
@Override
public void outsiderThreat(HashSet<ComponentType> vdm_components) {
    try {
        HashSet<String> components = new HashSet<String>();
        HashSet<String> otComponentTypeSet = new HashSet<String>(Arrays.asList("human", "swhumanhybrid", "hwhumanhybrid", "hybrid"));
        BlockImpl blockImpl = null;
        for (ComponentImpl componentImpl : vdm_model.getComponentImpl()) {
            blockImpl = componentImpl.getBlockImpl();
            // BlockImpl
            if (blockImpl != null) {
                ComponentType componentType = componentImpl.getType();
                for (ComponentInstance componentInstance : blockImpl.getSubcomponent()) {
                    componentType = getType(componentInstance);
                    List<GenericAttribute> attributeList = componentInstance.getAttribute();
                    GenericAttribute componentKindAttribute = getAttributeByName(attributeList, "ComponentType", componentInstance.getName());
                    GenericAttribute insideTrustedBoundaryAttribute = getAttributeByName(attributeList, "InsideTrustedBoundary", componentInstance.getName());
                    GenericAttribute physicalAccessControlAttribute = getAttributeByName(attributeList, "PhysicalAccessControl", componentInstance.getName());
                    GenericAttribute loggingAttribute = getAttributeByName(attributeList, "Logging", componentInstance.getName());
                    GenericAttribute systemAccessControlAttribute = getAttributeByName(attributeList, "SystemAccessControl", componentInstance.getName());
                    GenericAttribute userAuthenticationAttribute = getAttributeByName(attributeList, "UserAuthentication", componentInstance.getName());
                    String componentKind = componentKindAttribute.getValue().toString().toLowerCase();
                    Boolean insideTrustedBoundary = Boolean.parseBoolean(insideTrustedBoundaryAttribute.getValue().toString());
                    int physicalAccessControl = Integer.parseInt(physicalAccessControlAttribute.getValue().toString());
                    int logging = Integer.parseInt(loggingAttribute.getValue().toString());
                    int systemAccessControl = Integer.parseInt(systemAccessControlAttribute.getValue().toString());
                    int userAuthentication = Integer.parseInt(userAuthenticationAttribute.getValue().toString());
                    if (otComponentTypeSet.contains(componentKind) && !insideTrustedBoundary && physicalAccessControl == 0 && (logging == 0 && (systemAccessControl == 0 || userAuthentication == 0))) {
                        // Store component
                        vdm_components.add(componentType);
                        components.add(componentType.getId());
                    // instrument_component(componentType, blockImpl);
                    }
                }
            }
        }
        this.attack_cmp_link_map.put("OT", components);
    } catch (CRVException e) {
        System.out.println("\tCRV Error " + e.getCode() + " " + e.getMessage());
    }
}
Also used : BlockImpl(verdict.vdm.vdm_model.BlockImpl) ComponentType(verdict.vdm.vdm_model.ComponentType) ComponentInstance(verdict.vdm.vdm_model.ComponentInstance) GenericAttribute(verdict.vdm.vdm_data.GenericAttribute) ComponentImpl(verdict.vdm.vdm_model.ComponentImpl) HashSet(java.util.HashSet)

Example 13 with ComponentInstance

use of verdict.vdm.vdm_model.ComponentInstance in project VERDICT by ge-high-assurance.

the class Instrumentor method locationSpoofing.

// LS:
// - Select all components c in C such that:
// c.category = GPS or c.category = IMU or c.category = LIDAR or c.category = LOCATION_DEVICE
@Override
public void locationSpoofing(HashSet<ComponentType> vdm_components) {
    try {
        HashSet<String> components = new HashSet<String>();
        HashSet<String> locIdentificationDeviceSet = new HashSet<String>(Arrays.asList("gps", "dme_vor", "iru", "lidar", "imu"));
        BlockImpl blockImpl = null;
        for (ComponentImpl componentImpl : vdm_model.getComponentImpl()) {
            blockImpl = componentImpl.getBlockImpl();
            // BlockImpl
            if (blockImpl != null) {
                ComponentType componentType = componentImpl.getType();
                for (ComponentInstance componentInstance : blockImpl.getSubcomponent()) {
                    componentType = componentInstance.getSpecification();
                    ComponentImpl subcomponentImpl = componentInstance.getImplementation();
                    // Option 1) Specification
                    if (componentType != null) {
                    } else // Option 2) Implementation
                    if (subcomponentImpl != null) {
                        componentType = subcomponentImpl.getType();
                    }
                    List<GenericAttribute> attributeList = componentInstance.getAttribute();
                    GenericAttribute componentCategoryAttribute = getAttributeByName(attributeList, "Category", componentInstance.getName());
                    String componentCategory = componentCategoryAttribute.getValue().toString();
                    if (locIdentificationDeviceSet.contains(componentCategory.toLowerCase())) {
                        vdm_components.add(componentType);
                        components.add(componentType.getId());
                    }
                }
            }
        }
        this.attack_cmp_link_map.put("LS", components);
    } catch (CRVException e) {
        System.out.println("\tCRV Error " + e.getCode() + " " + e.getMessage());
    }
}
Also used : BlockImpl(verdict.vdm.vdm_model.BlockImpl) ComponentType(verdict.vdm.vdm_model.ComponentType) ComponentInstance(verdict.vdm.vdm_model.ComponentInstance) GenericAttribute(verdict.vdm.vdm_data.GenericAttribute) ComponentImpl(verdict.vdm.vdm_model.ComponentImpl) HashSet(java.util.HashSet)

Example 14 with ComponentInstance

use of verdict.vdm.vdm_model.ComponentInstance in project VERDICT by ge-high-assurance.

the class Instrumentor method hardwareTrojan.

// HT
// - Select all components c in C such that:
// c.ComponentKind is in {Hardware, SwHwHybrid, HwHumanHybrid, Hybrid}
// and c.adversariallyTestedForTrojanOrLogicBomb = 0
// and (c.pedigree = COTS or (c.pedigree = Sourced and c.supplyChainSecurity = 0 and
// c.tamperProtection = 0))
@Override
public void hardwareTrojan(HashSet<ComponentType> vdm_components) {
    try {
        HashSet<String> components = new HashSet<String>();
        HashSet<String> htComponentTypeSet = new HashSet<String>(Arrays.asList("hardware", "swhwhybrid", "hwhumanhybrid", "hybrid"));
        BlockImpl blockImpl = null;
        for (ComponentImpl componentImpl : vdm_model.getComponentImpl()) {
            blockImpl = componentImpl.getBlockImpl();
            // BlockImpl
            if (blockImpl != null) {
                ComponentType componentType = componentImpl.getType();
                for (ComponentInstance componentInstance : blockImpl.getSubcomponent()) {
                    componentType = getType(componentInstance);
                    List<GenericAttribute> attributeList = componentInstance.getAttribute();
                    GenericAttribute componentKindAttribute = getAttributeByName(attributeList, "ComponentType", componentInstance.getName());
                    GenericAttribute adversariallyTestedForTrojanOrLogicBombAttribute = getAttributeByName(attributeList, "AdversariallyTestedForTrojanOrLogicBomb", componentInstance.getName());
                    GenericAttribute pedigreeAttribute = getAttributeByName(attributeList, "Pedigree", componentInstance.getName());
                    GenericAttribute supplyChainSecurityAttribute = getAttributeByName(attributeList, "SupplyChainSecurity", componentInstance.getName());
                    GenericAttribute tamperProtectionAttribute = getAttributeByName(attributeList, "TamperProtection", componentInstance.getName());
                    String componentKind = componentKindAttribute.getValue().toString().toLowerCase();
                    int adversariallyTestedForTrojanOrLogicBomb = Integer.parseInt(adversariallyTestedForTrojanOrLogicBombAttribute.getValue().toString());
                    String pedigree = pedigreeAttribute.getValue().toString().toLowerCase();
                    int supplyChainSecurity = Integer.parseInt(supplyChainSecurityAttribute.getValue().toString());
                    int tamperProtection = Integer.parseInt(tamperProtectionAttribute.getValue().toString());
                    if (htComponentTypeSet.contains(componentKind) && adversariallyTestedForTrojanOrLogicBomb == 0 && (pedigree.equalsIgnoreCase("cots") || (pedigree.equalsIgnoreCase("sourced") && supplyChainSecurity == 0 && tamperProtection == 0))) {
                        // Store component
                        vdm_components.add(componentType);
                        components.add(componentType.getId());
                    // instrument_component(componentType, blockImpl);
                    }
                }
            }
        }
        this.attack_cmp_link_map.put("HT", components);
    } catch (CRVException e) {
        System.out.println("\tCRV Error " + e.getCode() + " " + e.getMessage());
    }
}
Also used : BlockImpl(verdict.vdm.vdm_model.BlockImpl) ComponentType(verdict.vdm.vdm_model.ComponentType) ComponentInstance(verdict.vdm.vdm_model.ComponentInstance) GenericAttribute(verdict.vdm.vdm_data.GenericAttribute) ComponentImpl(verdict.vdm.vdm_model.ComponentImpl) HashSet(java.util.HashSet)

Example 15 with ComponentInstance

use of verdict.vdm.vdm_model.ComponentInstance in project VERDICT by ge-high-assurance.

the class Instrumentor method insiderThreat.

// IT
// - Select all components c in C such that:
// c.componentType in {Human, SwHumanHybrid, HwHumanHybrid, Hybrid}
// and c.insideTrustBoundary = true
// and (c.logging = 0 and (c.systemAccessControl = 0 or c.userAuthentication = 0))
@Override
public void insiderThreat(HashSet<ComponentType> vdm_components) {
    try {
        HashSet<String> components = new HashSet<String>();
        HashSet<String> itComponentTypeSet = new HashSet<String>(Arrays.asList("human", "swhumanhybrid", "hwhumanhybrid", "hybrid"));
        BlockImpl blockImpl = null;
        for (ComponentImpl componentImpl : vdm_model.getComponentImpl()) {
            blockImpl = componentImpl.getBlockImpl();
            // BlockImpl
            if (blockImpl != null) {
                ComponentType componentType = componentImpl.getType();
                for (ComponentInstance componentInstance : blockImpl.getSubcomponent()) {
                    componentType = getType(componentInstance);
                    List<GenericAttribute> attributeList = componentInstance.getAttribute();
                    GenericAttribute componentKindAttribute = getAttributeByName(attributeList, "ComponentType", componentInstance.getName());
                    GenericAttribute insideTrustedBoundaryAttribute = getAttributeByName(attributeList, "InsideTrustedBoundary", componentInstance.getName());
                    GenericAttribute loggingAttribute = getAttributeByName(attributeList, "Logging", componentInstance.getName());
                    GenericAttribute systemAccessControlAttribute = getAttributeByName(attributeList, "SystemAccessControl", componentInstance.getName());
                    GenericAttribute userAuthenticationAttribute = getAttributeByName(attributeList, "UserAuthentication", componentInstance.getName());
                    String componentKind = componentKindAttribute.getValue().toString().toLowerCase();
                    Boolean insideTrustedBoundary = Boolean.parseBoolean(insideTrustedBoundaryAttribute.getValue().toString());
                    int logging = Integer.parseInt(loggingAttribute.getValue().toString());
                    int systemAccessControl = Integer.parseInt(systemAccessControlAttribute.getValue().toString());
                    int userAuthentication = Integer.parseInt(userAuthenticationAttribute.getValue().toString());
                    if (itComponentTypeSet.contains(componentKind) && insideTrustedBoundary && (logging == 0 && (systemAccessControl == 0 || userAuthentication == 0))) {
                        // Store component
                        vdm_components.add(componentType);
                        components.add(componentType.getId());
                    // instrument_component(componentType, blockImpl);
                    }
                }
            }
        }
        this.attack_cmp_link_map.put("IT", components);
    } catch (CRVException e) {
        System.out.println("\tCRV Error " + e.getCode() + " " + e.getMessage());
    }
}
Also used : BlockImpl(verdict.vdm.vdm_model.BlockImpl) ComponentType(verdict.vdm.vdm_model.ComponentType) ComponentInstance(verdict.vdm.vdm_model.ComponentInstance) GenericAttribute(verdict.vdm.vdm_data.GenericAttribute) ComponentImpl(verdict.vdm.vdm_model.ComponentImpl) HashSet(java.util.HashSet)

Aggregations

ComponentImpl (verdict.vdm.vdm_model.ComponentImpl)23 ComponentInstance (verdict.vdm.vdm_model.ComponentInstance)23 ComponentType (verdict.vdm.vdm_model.ComponentType)21 BlockImpl (verdict.vdm.vdm_model.BlockImpl)17 HashSet (java.util.HashSet)10 GenericAttribute (verdict.vdm.vdm_data.GenericAttribute)8 CompInstancePort (verdict.vdm.vdm_model.CompInstancePort)8 Port (verdict.vdm.vdm_model.Port)8 Connection (verdict.vdm.vdm_model.Connection)6 ConnectionEnd (verdict.vdm.vdm_model.ConnectionEnd)6 Expression (verdict.vdm.vdm_lustre.Expression)3 PortMode (verdict.vdm.vdm_model.PortMode)3 ArrayList (java.util.ArrayList)2 ContractItem (verdict.vdm.vdm_lustre.ContractItem)2 ContractSpec (verdict.vdm.vdm_lustre.ContractSpec)2 IfThenElse (verdict.vdm.vdm_lustre.IfThenElse)2 NodeBody (verdict.vdm.vdm_lustre.NodeBody)2 NodeCall (verdict.vdm.vdm_lustre.NodeCall)2 NodeEquation (verdict.vdm.vdm_lustre.NodeEquation)2 NodeEquationLHS (verdict.vdm.vdm_lustre.NodeEquationLHS)2